diff --git a/INSTALL.txt b/INSTALL.txt
index 5b4f588b7..18eae9d07 100644
--- a/INSTALL.txt
+++ b/INSTALL.txt
@@ -50,11 +50,10 @@ Internet Explorer 7 or later
|* PHP Configuration *|
-----------------------
In the PHP configuration file (php.ini), set the following settings:
- memory_limit = 120M
+ memory_limit = 256M
file_uploads = On
short_open_tag = On
-The memory_limit may be a minimum of 80MB, but it is recommended to set it to
-120MB. If planning on uploading large Input Documents and attached files, then
+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
2MB:
max_post_size = 2M
diff --git a/database/factories/AbeConfigurationFactory.php b/database/factories/AbeConfigurationFactory.php
index 8e9dd8b63..50f34ab21 100644
--- a/database/factories/AbeConfigurationFactory.php
+++ b/database/factories/AbeConfigurationFactory.php
@@ -27,7 +27,7 @@ $factory->define(\ProcessMaker\Model\AbeConfiguration::class, function (Faker $f
'ABE_UPDATE_DATE' => $faker->dateTime(),
'ABE_SUBJECT_FIELD' => '',
'ABE_MAILSERVER_OR_MAILCURRENT' => 0,
- 'ABE_CUSTOM_GRID' => '',
+ 'ABE_CUSTOM_GRID' => serialize([]),
'ABE_EMAIL_SERVER_UID' => $emailServer->MESS_UID,
'ABE_ACTION_BODY_FIELD' => '',
'ABE_EMAIL_SERVER_RECEIVER_UID' => ''
diff --git a/database/factories/AppNotesFactory.php b/database/factories/AppNotesFactory.php
new file mode 100644
index 000000000..0f6cdd446
--- /dev/null
+++ b/database/factories/AppNotesFactory.php
@@ -0,0 +1,40 @@
+define(\ProcessMaker\Model\AppNotes::class, function (Faker $faker) {
+ return [
+ 'APP_UID' => G::generateUniqueID(),
+ 'USR_UID' => G::generateUniqueID(),
+ 'NOTE_DATE' => $faker->dateTime(),
+ 'NOTE_CONTENT' => $faker->sentence(3),
+ 'NOTE_TYPE' => 'USER',
+ 'NOTE_AVAILABILITY' => 'PUBLIC',
+ 'NOTE_ORIGIN_OBJ' => '',
+ 'NOTE_AFFECTED_OBJ1' => '',
+ 'NOTE_AFFECTED_OBJ2' => '',
+ 'NOTE_RECIPIENTS' => '',
+ ];
+});
+
+// Create a case notes with the foreign keys
+$factory->state(\ProcessMaker\Model\AppNotes::class, 'foreign_keys', function (Faker $faker) {
+ // Create values in the foreign key relations
+ $application = factory(\ProcessMaker\Model\Application::class)->create();
+ $user = factory(\ProcessMaker\Model\User::class)->create();
+
+ // Return with default values
+ return [
+ 'APP_UID' => $application->APP_UID,
+ 'USR_UID' => $user->USR_UID,
+ 'NOTE_DATE' => $faker->dateTime(),
+ 'NOTE_CONTENT' => $faker->sentence(3),
+ 'NOTE_TYPE' => 'USER',
+ 'NOTE_AVAILABILITY' => 'PUBLIC',
+ 'NOTE_ORIGIN_OBJ' => '',
+ 'NOTE_AFFECTED_OBJ1' => '',
+ 'NOTE_AFFECTED_OBJ2' => '',
+ 'NOTE_RECIPIENTS' => '',
+ ];
+});
+
diff --git a/database/factories/ProcessVariablesFactory.php b/database/factories/ProcessVariablesFactory.php
index 6892de0b9..d7ee63666 100644
--- a/database/factories/ProcessVariablesFactory.php
+++ b/database/factories/ProcessVariablesFactory.php
@@ -15,7 +15,7 @@ $factory->define(ProcessVariables::class, function (Faker $faker) {
'VAR_SQL' => '',
'VAR_NULL' => 0,
'VAR_DEFAULT' => '',
- 'VAR_ACCEPTED_VALUES' => '',
+ 'VAR_ACCEPTED_VALUES' => '[]',
'INP_DOC_UID' => ''
];
});
\ No newline at end of file
diff --git a/framework/src/Maveriks/WebApplication.php b/framework/src/Maveriks/WebApplication.php
index 82a9c5e97..46c788a23 100644
--- a/framework/src/Maveriks/WebApplication.php
+++ b/framework/src/Maveriks/WebApplication.php
@@ -536,7 +536,6 @@ class WebApplication
ini_set('error_reporting', $arraySystemConfiguration['error_reporting']);
ini_set('short_open_tag', 'On'); //??
ini_set('default_charset', 'UTF-8'); //??
- ini_set('memory_limit', $arraySystemConfiguration['memory_limit']);
ini_set('soap.wsdl_cache_enabled', $arraySystemConfiguration['wsdl_cache']);
ini_set('date.timezone', TIME_ZONE); //Set Time Zone
diff --git a/gulliver/bin/tasks/templates/sysGeneric.php.tpl b/gulliver/bin/tasks/templates/sysGeneric.php.tpl
index 79914245e..f89aba6fe 100644
--- a/gulliver/bin/tasks/templates/sysGeneric.php.tpl
+++ b/gulliver/bin/tasks/templates/sysGeneric.php.tpl
@@ -3,7 +3,6 @@
/*** enable display_error On to caught even fatal errors ***/
ini_set('display_errors','On');
ini_set('error_reporting', E_ALL );
-ini_set('memory_limit', '80M');
$path = Array();
$sf = $_SERVER['SCRIPT_FILENAME'];
diff --git a/gulliver/system/class.dbMaintenance.php b/gulliver/system/class.dbMaintenance.php
index cfa1ce711..bb3905a58 100644
--- a/gulliver/system/class.dbMaintenance.php
+++ b/gulliver/system/class.dbMaintenance.php
@@ -436,7 +436,6 @@ class DataBaseMaintenance
*/
public function restoreFromSql($sqlFile, $type = 'file')
{
- ini_set('memory_limit', '64M');
if ($type == 'file' && !is_file($sqlFile)) {
throw new Exception("the $sqlFile doesn't exist!");
}
diff --git a/gulliver/system/class.g.php b/gulliver/system/class.g.php
index ee129521e..486670b0c 100644
--- a/gulliver/system/class.g.php
+++ b/gulliver/system/class.g.php
@@ -2750,11 +2750,6 @@ class G
if (!array_key_exists("channels", $imageInfo)) {
$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'
), IMAGETYPE_JPEG => array('imagecreatefromjpeg', 'imagejpeg'), IMAGETYPE_PNG => array('imagecreatefrompng', 'imagepng'));
diff --git a/tests/Feature/DBQueryTest.php b/tests/Feature/DBQueryTest.php
index a2ee1b029..00b15c367 100644
--- a/tests/Feature/DBQueryTest.php
+++ b/tests/Feature/DBQueryTest.php
@@ -23,6 +23,7 @@ class DBQueryTest extends TestCase
/**
* Verify the execution of a common SQL statement.
+ * Note, this test is now using Laravel DB backend work
* @test
*/
public function testStandardExecuteQuery()
diff --git a/tests/unit/workflow/engine/classes/ActionsByEmailCoreClassTest.php b/tests/unit/workflow/engine/classes/ActionsByEmailCoreClassTest.php
new file mode 100644
index 000000000..f3ff0dd3a
--- /dev/null
+++ b/tests/unit/workflow/engine/classes/ActionsByEmailCoreClassTest.php
@@ -0,0 +1,534 @@
+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);
+ }
+}
diff --git a/tests/unit/workflow/engine/classes/ProcessesTest.php b/tests/unit/workflow/engine/classes/ProcessesTest.php
index 207ebe127..e8fa446cc 100644
--- a/tests/unit/workflow/engine/classes/ProcessesTest.php
+++ b/tests/unit/workflow/engine/classes/ProcessesTest.php
@@ -9,6 +9,7 @@ use ProcessMaker\Model\Dynaform;
use ProcessMaker\Model\InputDocument;
use ProcessMaker\Model\OutputDocument;
use ProcessMaker\Model\Process;
+use ProcessMaker\Model\ProcessVariables;
use Tests\TestCase;
class ProcessesTest extends TestCase
@@ -479,4 +480,70 @@ class ProcessesTest extends TestCase
$this->assertObjectHasAttribute($key, $result);
}
}
+
+ /**
+ * Test it create a variable from old xml fields
+ *
+ * @covers \Processes::createProcessVariables()
+ * @test
+ */
+ public function it_create_variables_from_import_old()
+ {
+ $process = factory(\ProcessMaker\Model\Process::class)->create();
+ $attributes[] = [
+ 'VAR_UID' => G::generateUniqueID(),
+ 'PRJ_UID' => $process->PRO_UID,
+ 'VAR_NAME' => 'varTest',
+ 'VAR_FIELD_TYPE' => 'integer',
+ 'VAR_FIELD_SIZE' => 10,
+ 'VAR_LABEL' => 'string',
+ 'VAR_DBCONNECTION' => '',
+ 'VAR_SQL' => '',
+ 'VAR_NULL' => 0,
+ 'VAR_DEFAULT' => '',
+ 'VAR_ACCEPTED_VALUES' => '[]',
+ 'INP_DOC_UID' => ''
+ ];
+ $processes = new Processes();
+ $processes->createProcessVariables($attributes);
+ $result = ProcessVariables::getVariables($process->PRO_ID);
+ $this->assertNotEmpty($result);
+ $result = head($result);
+ $this->assertArrayHasKey('PRO_ID', $result, "The result does not contains 'PRO_ID' as a key");
+ $this->assertArrayHasKey('VAR_FIELD_TYPE_ID', $result, "The result does not contains 'VAR_FIELD_TYPE_ID' as a key");
+ $this->assertEquals($result['VAR_FIELD_TYPE_ID'], 2);
+ }
+
+ /**
+ * Test it create a variable from new xml fields
+ *
+ * @covers \Processes::createProcessVariables()
+ * @test
+ */
+ public function it_create_variables_from_import_new()
+ {
+ $process = factory(\ProcessMaker\Model\Process::class)->create();
+ $attributes[] = [
+ 'VAR_UID' => G::generateUniqueID(),
+ 'PRJ_UID' => $process->PRO_UID,
+ 'VAR_NAME' => 'varTest',
+ 'VAR_FIELD_TYPE' => 'string',
+ 'VAR_FIELD_TYPE_ID' => 1,
+ 'VAR_FIELD_SIZE' => 10,
+ 'VAR_LABEL' => 'string',
+ 'VAR_DBCONNECTION' => '',
+ 'VAR_SQL' => '',
+ 'VAR_NULL' => 0,
+ 'VAR_DEFAULT' => '',
+ 'VAR_ACCEPTED_VALUES' => '[]',
+ 'INP_DOC_UID' => ''
+ ];
+ $processes = new Processes();
+ $processes->createProcessVariables($attributes);
+ $result = ProcessVariables::getVariables($process->PRO_ID);
+ $this->assertNotEmpty($result);
+ $result = head($result);
+ $this->assertArrayHasKey('PRO_ID', $result, "The result does not contains 'PRO_ID' as a key");
+ $this->assertArrayHasKey('VAR_FIELD_TYPE_ID', $result, "The result does not contains 'VAR_FIELD_TYPE_ID' as a key");
+ }
}
diff --git a/tests/unit/workflow/engine/classes/WsBaseTest.php b/tests/unit/workflow/engine/classes/WsBaseTest.php
index 3c7a1ffb5..c88f56795 100755
--- a/tests/unit/workflow/engine/classes/WsBaseTest.php
+++ b/tests/unit/workflow/engine/classes/WsBaseTest.php
@@ -12,7 +12,6 @@ use ProcessMaker\Model\Process;
use ProcessMaker\Model\Task;
use ProcessMaker\Model\User;
use ProcessMaker\Model\UserReporting;
-use ProcessMaker\Util\WsMessageResponse;
use Tests\TestCase;
/**
@@ -22,6 +21,7 @@ use Tests\TestCase;
*/
class WsBaseTest extends TestCase
{
+
use DatabaseTransactions;
/**
@@ -65,21 +65,20 @@ class WsBaseTest extends TestCase
*/
private function createNewCase($applicationNumber = null)
{
+ $userUid = G::generateUniqueID();
+ $processUid = G::generateUniqueID();
+ $applicationUid = G::generateUniqueID();
if (empty($applicationNumber)) {
$faker = Factory::create();
$applicationNumber = $faker->unique()->numberBetween(1, 10000000);
}
- $userUid = G::generateUniqueID();
- $processUid = G::generateUniqueID();
- $taskUid = G::generateUniqueID();
- $applicationUid = G::generateUniqueID();
$appData = [
'SYS_LANG' => 'en',
'SYS_SKIN' => 'neoclassic',
'SYS_SYS' => 'workflow',
- 'APPLICATION' => G::generateUniqueID(),
- 'PROCESS' => G::generateUniqueID(),
+ 'APPLICATION' => $applicationUid,
+ 'PROCESS' => $processUid,
'TASK' => '',
'INDEX' => 2,
'USER_LOGGED' => $userUid,
@@ -108,16 +107,9 @@ class WsBaseTest extends TestCase
]);
$result = new stdClass();
- $result->userUid = $userUid;
- $result->processUid = $processUid;
- $result->taskUid = $taskUid;
- $result->applicationUid = $applicationUid;
- $result->applicationNumber = $applicationNumber;
- $result->appData = $appData;
+ $result->application = $application;
$result->user = $user;
$result->process = $process;
- $result->task = $task;
- $result->application = $application;
return $result;
}
@@ -229,7 +221,7 @@ class WsBaseTest extends TestCase
$template = $this->createTemplate($case->process->PRO_UID, $case->user->USR_UID);
//parameters
- $appUid = $case->applicationUid;
+ $appUid = $case->application->APP_UID;
$from = $emailServer->MESS_ACCOUNT;
$to = $emailServer->MESS_ACCOUNT;
$cc = "";
@@ -269,7 +261,7 @@ class WsBaseTest extends TestCase
$template = $this->createTemplate($case->process->PRO_UID, $case->user->USR_UID);
//parameters
- $appUid = $case->applicationUid;
+ $appUid = $case->application->APP_UID;
$from = $emailServer->MESS_ACCOUNT;
$to = "";
$cc = "";
@@ -308,7 +300,7 @@ class WsBaseTest extends TestCase
$template = $this->createTemplate($case->process->PRO_UID, $case->user->USR_UID);
//parameters
- $appUid = $case->applicationUid;
+ $appUid = $case->application->APP_UID;
$from = $emailServer->MESS_ACCOUNT;
$to = $emailServer->MESS_ACCOUNT;
$cc = "";
@@ -347,7 +339,7 @@ class WsBaseTest extends TestCase
$template = $this->createTemplate($case->process->PRO_UID, $case->user->USR_UID);
//parameters
- $appUid = $case->applicationUid;
+ $appUid = $case->application->APP_UID;
$from = $emailServer->MESS_ACCOUNT;
$to = "";
$cc = "";
@@ -386,7 +378,7 @@ class WsBaseTest extends TestCase
$template = $this->createTemplate($case->process->PRO_UID, $case->user->USR_UID);
//parameters
- $appUid = $case->applicationUid;
+ $appUid = $case->application->APP_UID;
$from = $emailServer->MESS_ACCOUNT;
$to = $emailServer->MESS_ACCOUNT;
$cc = "";
@@ -425,7 +417,7 @@ class WsBaseTest extends TestCase
$template = $this->createTemplate($case->process->PRO_UID, $case->user->USR_UID);
//parameters
- $appUid = $case->applicationUid;
+ $appUid = $case->application->APP_UID;
$from = $emailServer->MESS_ACCOUNT;
$to = "";
$cc = "";
@@ -464,7 +456,7 @@ class WsBaseTest extends TestCase
$template = $this->createTemplate($case->process->PRO_UID, $case->user->USR_UID);
//parameters
- $appUid = $case->applicationUid;
+ $appUid = $case->application->APP_UID;
$from = $emailServer->MESS_ACCOUNT;
$to = "";
$cc = "";
@@ -644,7 +636,7 @@ class WsBaseTest extends TestCase
$template = $this->createTemplate($case->process->PRO_UID, $case->user->USR_UID);
//parameters
- $appUid = $case->applicationUid;
+ $appUid = $case->application->APP_UID;
$from = $faker->email;
$to = "";
$cc = "";
@@ -659,7 +651,131 @@ class WsBaseTest extends TestCase
$result = $wsBase->sendMessage($appUid, $from, $to, $cc, $bcc, $subject, $templateName, $appFields);
//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;
$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->assertNotEmpty($response);
}
@@ -695,7 +811,7 @@ class WsBaseTest extends TestCase
{
$delegation = factory(Delegation::class)->states('foreign_keys')->create();
$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->message, G::LoadTranslation("ID_REQUIRED_FIELD") . ' caseUid');
}
@@ -718,7 +834,7 @@ class WsBaseTest extends TestCase
'APP_UID' => $application->APP_UID,
]);
$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->message, G::LoadTranslation("ID_CASE_IN_STATUS") . ' DRAFT');
@@ -732,7 +848,7 @@ class WsBaseTest extends TestCase
'APP_UID' => $application->APP_UID,
]);
$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->message, G::LoadTranslation("ID_CASE_IN_STATUS") . ' COMPLETED');
@@ -746,7 +862,7 @@ class WsBaseTest extends TestCase
'APP_UID' => $application->APP_UID,
]);
$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->message, G::LoadTranslation("ID_CASE_IN_STATUS") . ' CANCELLED');
}
@@ -768,7 +884,7 @@ class WsBaseTest extends TestCase
'APP_UID' => $application->APP_UID,
]);
$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->message, G::LoadTranslation("ID_REQUIRED_FIELD") . ' delIndex');
}
@@ -791,7 +907,7 @@ class WsBaseTest extends TestCase
'DEL_THREAD_STATUS' => 'CLOSED'
]);
$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->message, G::LoadTranslation("ID_CASE_DELEGATION_ALREADY_CLOSED"));
}
@@ -813,7 +929,7 @@ class WsBaseTest extends TestCase
'APP_UID' => $application->APP_UID,
]);
$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->message, G::LoadTranslation("ID_REQUIRED_FIELD") . ' userUid');
}
@@ -857,7 +973,7 @@ class WsBaseTest extends TestCase
]);
$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->message, G::LoadTranslation("ID_CASE_CANCELLED_PARALLEL"));
}
@@ -904,7 +1020,7 @@ class WsBaseTest extends TestCase
]);
$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->assertObjectHasAttribute('status_code', $response);
$this->assertEquals($response->message, G::LoadTranslation("ID_COMMAND_EXECUTED_SUCCESSFULLY"));
@@ -969,7 +1085,7 @@ class WsBaseTest extends TestCase
]);
$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->assertObjectHasAttribute('status_code', $response);
$this->assertEquals($response->message, G::LoadTranslation("ID_COMMAND_EXECUTED_SUCCESSFULLY"));
@@ -1002,7 +1118,7 @@ class WsBaseTest extends TestCase
'DEL_INDEX' => 2,
]);
$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->message, "The Application row '$fakeApp' doesn't exist!");
}
diff --git a/tests/unit/workflow/engine/classes/WsResponseTest.php b/tests/unit/workflow/engine/classes/WsResponseTest.php
new file mode 100644
index 000000000..33f5fa2d6
--- /dev/null
+++ b/tests/unit/workflow/engine/classes/WsResponseTest.php
@@ -0,0 +1,86 @@
+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);
+ }
+}
diff --git a/tests/unit/workflow/engine/classes/model/AppNotesTest.php b/tests/unit/workflow/engine/classes/model/AppNotesTest.php
new file mode 100644
index 000000000..e6529b4f4
--- /dev/null
+++ b/tests/unit/workflow/engine/classes/model/AppNotesTest.php
@@ -0,0 +1,104 @@
+create();
+ $user = factory(User::class)->create();
+ $reason = "The case was canceled due to:";
+ $appNotes = new ModelAppNotes();
+ $noteContent = addslashes($reason);
+ $appNotes->postNewNote(
+ $application->APP_UID, $user->USR_UID, $noteContent, false
+ );
+
+ // Query to get the cases notes
+ $query = AppNotes::query();
+ $query->select()->where('APP_UID', $application->APP_UID)->where('USR_UID', $user->USR_UID);
+ $result = $query->get()->values()->toArray();
+ $this->assertNotEmpty($result);
+ }
+
+ /**
+ * It test the cases notes creation and send a email to specific user
+ *
+ * @test
+ */
+ public function it_test_case_notes_creation_and_send_email_to_user()
+ {
+ $application = factory(Application::class)->create();
+ $user = factory(User::class)->create();
+ $reason = "The case was canceled due to:";
+ $appNotes = new ModelAppNotes();
+ $noteContent = addslashes($reason);
+ $appNotes->postNewNote(
+ $application->APP_UID, $user->USR_UID, $noteContent, true, 'PUBLIC', $user->USR_UID
+ );
+
+ // Query to get the cases notes
+ $query = AppNotes::query();
+ $query->select()->where('APP_UID', $application->APP_UID)->where('USR_UID', $user->USR_UID);
+ $result = $query->get()->values()->toArray();
+ $this->assertNotEmpty($result);
+
+ // Query to get the emails
+ $query = AppMessage::query();
+ $query->select()->where('APP_UID', $application->APP_UID)->where('APP_MSG_TYPE', 'CASE_NOTE');
+ $result = $query->get()->values()->toArray();
+ $this->assertNotEmpty($result);
+ }
+
+ /**
+ * It test the cases notes creation and send a email to user with participaion in the case
+ *
+ * @test
+ */
+ public function it_test_case_notes_creation_and_send_email()
+ {
+ $application = factory(Application::class)->create();
+ $user = factory(User::class)->create();
+ factory(Delegation::class)->create([
+ 'APP_UID' => $application->APP_UID,
+ 'USR_UID' => $user->USR_UID
+ ]);
+ $reason = "The case was canceled due to:";
+ $appNotes = new ModelAppNotes();
+ $noteContent = addslashes($reason);
+ $appNotes->postNewNote(
+ $application->APP_UID, $user->USR_UID, $noteContent, true, 'PUBLIC'
+ );
+
+ // Query to get the cases notes
+ $query = AppNotes::query();
+ $query->select()->where('APP_UID', $application->APP_UID)->where('USR_UID', $user->USR_UID);
+ $result = $query->get()->values()->toArray();
+ $this->assertNotEmpty($result);
+
+ // Query to get the emails
+ $query = AppMessage::query();
+ $query->select()->where('APP_UID', $application->APP_UID)->where('APP_MSG_TYPE', 'CASE_NOTE');
+ $result = $query->get()->values()->toArray();
+ $this->assertNotEmpty($result);
+ }
+}
\ No newline at end of file
diff --git a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/VariableTest.php b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/VariableTest.php
new file mode 100644
index 000000000..794dd14f2
--- /dev/null
+++ b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/VariableTest.php
@@ -0,0 +1,191 @@
+create();
+
+ factory(ProcessVariables::class)->create([
+ 'PRJ_UID' => $process->PRO_UID,
+ 'PRO_ID' => $process->PRO_ID,
+ ]
+ );
+ $properties = [
+ 'VAR_UID' => G::generateUniqueID(),
+ 'VAR_NAME' => 'var_test',
+ 'VAR_FIELD_TYPE' => 'string',
+ 'VAR_FIELD_SIZE' => 10,
+ 'VAR_LABEL' => 'string',
+ 'VAR_DBCONNECTION' => '',
+ 'VAR_SQL' => '',
+ 'VAR_NULL' => 0,
+ 'VAR_DEFAULT' => '',
+ 'VAR_ACCEPTED_VALUES' => '[]',
+ 'INP_DOC_UID' => ''
+ ];
+
+ $variable = new Variable();
+ $res = $variable->create($process->PRO_UID, $properties);
+ $this->assertNotEmpty($res);
+ $this->assertArrayHasKey('var_uid', $res, "The result does not contains 'var_uid' as key");
+ $this->assertArrayHasKey('prj_uid', $res, "The result does not contains 'prj_uid' as key");
+ $this->assertArrayHasKey('var_name', $res, "The result does not contains 'var_name' as key");
+ $this->assertArrayHasKey('var_field_type', $res, "The result does not contains 'var_field_type' as key");
+ $this->assertArrayHasKey('var_field_size', $res, "The result does not contains 'var_field_size' as key");
+ $this->assertArrayHasKey('var_label', $res, "The result does not contains 'var_label' as key");
+ $this->assertArrayHasKey('var_dbconnection', $res, "The result does not contains 'var_dbconnection' as key");
+ $this->assertArrayHasKey('var_dbconnection_label', $res, "The result does not contains 'var_dbconnection_label' as key");
+ $this->assertArrayHasKey('var_sql', $res, "The result does not contains 'var_sql' as key");
+ $this->assertArrayHasKey('var_null', $res, "The result does not contains 'var_null' as key");
+ $this->assertArrayHasKey('var_default', $res, "The result does not contains 'var_default' as key");
+ $this->assertArrayHasKey('var_accepted_values', $res, "The result does not contains 'var_accepted_values' as key");
+ $this->assertArrayHasKey('inp_doc_uid', $res, "The result does not contains 'inp_doc_uid' as key");
+ }
+
+ /**
+ * Tests the exception
+ *
+ * @covers \ProcessMaker\BusinessModel\Variable::create()
+ * @test
+ */
+ public function it_return_an_exception_when_var_name_is_empty()
+ {
+ $process = factory(Process::class)->create();
+ factory(ProcessVariables::class)->create([
+ 'PRJ_UID' => $process->PRO_UID,
+ 'PRO_ID' => $process->PRO_ID,
+ ]
+ );
+ $properties = [
+ 'VAR_UID' => G::generateUniqueID(),
+ 'VAR_NAME' => '',
+ 'VAR_FIELD_TYPE' => 'string',
+ 'VAR_FIELD_SIZE' => 10,
+ 'VAR_LABEL' => 'string',
+ 'VAR_DBCONNECTION' => '',
+ 'VAR_SQL' => '',
+ 'VAR_NULL' => 0,
+ 'VAR_DEFAULT' => '',
+ 'VAR_ACCEPTED_VALUES' => '[]',
+ 'INP_DOC_UID' => ''
+ ];
+ $variable = new Variable();
+ $this->expectExceptionMessage("**ID_CAN_NOT_BE_NULL**");
+ $res = $variable->create($process->PRO_UID, $properties);
+ }
+
+ /**
+ * Tests the exception
+ *
+ * @covers \ProcessMaker\BusinessModel\Variable::create()
+ * @test
+ */
+ public function it_return_an_exception_when_var_field_type_is_empty()
+ {
+ $process = factory(Process::class)->create();
+ factory(ProcessVariables::class)->create([
+ 'PRJ_UID' => $process->PRO_UID,
+ 'PRO_ID' => $process->PRO_ID,
+ ]
+ );
+ $properties = [
+ 'VAR_UID' => G::generateUniqueID(),
+ 'VAR_NAME' => 'var_test',
+ 'VAR_FIELD_TYPE' => '',
+ 'VAR_FIELD_SIZE' => 10,
+ 'VAR_LABEL' => 'string',
+ 'VAR_DBCONNECTION' => '',
+ 'VAR_SQL' => '',
+ 'VAR_NULL' => 0,
+ 'VAR_DEFAULT' => '',
+ 'VAR_ACCEPTED_VALUES' => '[]',
+ 'INP_DOC_UID' => ''
+ ];
+ $variable = new Variable();
+ $this->expectExceptionMessage("**ID_CAN_NOT_BE_NULL**");
+ $res = $variable->create($process->PRO_UID, $properties);
+ }
+
+ /**
+ * Tests the exception
+ *
+ * @covers \ProcessMaker\BusinessModel\Variable::create()
+ * @test
+ */
+ public function it_return_an_exception_when_var_label_is_empty()
+ {
+ $process = factory(Process::class)->create();
+ factory(ProcessVariables::class)->create([
+ 'PRJ_UID' => $process->PRO_UID,
+ 'PRO_ID' => $process->PRO_ID,
+ ]
+ );
+ $properties = [
+ 'VAR_UID' => G::generateUniqueID(),
+ 'VAR_NAME' => 'var_test',
+ 'VAR_FIELD_TYPE' => 'string',
+ 'VAR_FIELD_SIZE' => 10,
+ 'VAR_LABEL' => '',
+ 'VAR_DBCONNECTION' => '',
+ 'VAR_SQL' => '',
+ 'VAR_NULL' => 0,
+ 'VAR_DEFAULT' => '',
+ 'VAR_ACCEPTED_VALUES' => '[]',
+ 'INP_DOC_UID' => ''
+ ];
+ $variable = new Variable();
+ $this->expectExceptionMessage("**ID_CAN_NOT_BE_NULL**");
+ $res = $variable->create($process->PRO_UID, $properties);
+ }
+
+ /**
+ * Test it return the variables related to the PRO_UID
+ *
+ * @covers \ProcessMaker\BusinessModel\Variable::getVariables()
+ * @test
+ */
+ public function it_list_variables_by_process()
+ {
+ $process = factory(Process::class)->create();
+
+ factory(ProcessVariables::class)->create([
+ 'PRJ_UID' => $process->PRO_UID,
+ 'PRO_ID' => $process->PRO_ID,
+ ]
+ );
+ $variable = new Variable();
+ $res = $variable->getVariables($process->PRO_UID);
+ $this->assertNotEmpty($res);
+ $res = head($res);
+ $this->assertArrayHasKey('var_uid', $res, "The result does not contains 'var_uid' as key");
+ $this->assertArrayHasKey('prj_uid', $res, "The result does not contains 'prj_uid' as key");
+ $this->assertArrayHasKey('var_name', $res, "The result does not contains 'var_name' as key");
+ $this->assertArrayHasKey('var_field_type', $res, "The result does not contains 'var_field_type' as key");
+ $this->assertArrayHasKey('var_field_size', $res, "The result does not contains 'var_field_size' as key");
+ $this->assertArrayHasKey('var_label', $res, "The result does not contains 'var_label' as key");
+ $this->assertArrayHasKey('var_dbconnection', $res, "The result does not contains 'var_dbconnection' as key");
+ $this->assertArrayHasKey('var_dbconnection_label', $res, "The result does not contains 'var_dbconnection_label' as key");
+ $this->assertArrayHasKey('var_sql', $res, "The result does not contains 'var_sql' as key");
+ $this->assertArrayHasKey('var_null', $res, "The result does not contains 'var_null' as key");
+ $this->assertArrayHasKey('var_default', $res, "The result does not contains 'var_default' as key");
+ $this->assertArrayHasKey('var_accepted_values', $res, "The result does not contains 'var_accepted_values' as key");
+ $this->assertArrayHasKey('inp_doc_uid', $res, "The result does not contains 'inp_doc_uid' as key");
+ }
+}
diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Core/SystemTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Core/SystemTest.php
index 5065344e9..56d03ba37 100644
--- a/tests/unit/workflow/engine/src/ProcessMaker/Core/SystemTest.php
+++ b/tests/unit/workflow/engine/src/ProcessMaker/Core/SystemTest.php
@@ -237,4 +237,54 @@ class SystemTest extends TestCase
// Restore content of th env.ini file
file_put_contents($path, $oldContent);
}
+
+ /**
+ * This represents a set of connection strings that make up the dsn string.
+ * https://processmaker.atlassian.net/browse/PMCORE-574
+ * @return array
+ */
+ public function dsnConections()
+ {
+ return [
+ ["oci8", "user1", "das#4dba", "localhost", "1521", "testDatabase?encoding=utf8"],
+ ["mssql", "user1", "Sample12345!@#", "localhost", "1433", "testDatabase?encoding=utf8"],
+ ["mysqli", "user1", "123*/.abc-+", "localhost", "3306", "testDatabase?encoding=utf8"],
+ ["mysqli", "user1", "123*/.abc-+", "localhost", "", "testDatabase?encoding=utf8"],
+ ["sqlite", "user1", "das#4dba", "localhost", "", "testDatabase?encoding=utf8"],
+ ["sybase", "user1", "123!das#4dba", "localhost", "1433", "testDatabase?encoding=utf8"],
+ ["sybase", "user1", "123!das@#4dba", "localhost", "1433", "testDatabase?encoding=utf8"],
+ ["sybase", "user1", "123!das@#4db@a", "localhost", "1433", "testDatabase?encoding=utf8"],
+ ];
+ }
+
+ /**
+ * This tests the parsing of the dsn string.
+ * @test
+ * @dataProvider dsnConections
+ * @covers \Creole::parseDSN()
+ * @covers \ProcessMaker\Core\System::parseUrlWithNotEncodedPassword()
+ */
+ public function it_should_return_parse_url_for_dsn_string_with_special_characters($scheme, $user, $password, $host, $port, $database)
+ {
+ $hostname = $host;
+ if (!empty($port)) {
+ $hostname = $host . ":" . $port;
+ }
+ $dsn = $scheme . "://" . $user . ":" . $password . "@" . $hostname . "/" . $database;
+ $result = System::parseUrlWithNotEncodedPassword($dsn);
+ $this->assertEquals($scheme, $result["scheme"]);
+ $this->assertEquals($user, $result["user"]);
+ $this->assertEquals($password, $result["pass"]);
+ $this->assertEquals($host, $result["host"]);
+ if (!empty($port)) {
+ $this->assertEquals($port, $result["port"]);
+ }
+
+ $dsn = $scheme;
+ $result = System::parseUrlWithNotEncodedPassword($dsn);
+ $this->assertEmpty($result["scheme"]);
+ $this->assertEmpty($result["user"]);
+ $this->assertEmpty($result["pass"]);
+ $this->assertEmpty($result["host"]);
+ }
}
diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Importer/XmlImporterTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Importer/XmlImporterTest.php
index 1cf6ae13a..dda3d3677 100644
--- a/tests/unit/workflow/engine/src/ProcessMaker/Importer/XmlImporterTest.php
+++ b/tests/unit/workflow/engine/src/ProcessMaker/Importer/XmlImporterTest.php
@@ -233,7 +233,7 @@ class XmlImporterTest extends TestCase
* Test the import new option and the import new group option with repeated title.
* @test
* @covers \ProcessMaker\Importer\XmlImporter::import()
- * @covers \ProcessMaker\Importer\XmlImporter::updateTheProcessOwner()
+ * @covers \ProcessMaker\Importer\XmlImporter::updateProcessInformation()
*/
public function it_should_matter_with_import_option_create_new_and_group_import_option_create_new_try_rename_title()
{
diff --git a/tests/unit/workflow/engine/src/ProcessMaker/Model/ProcessVariablesTest.php b/tests/unit/workflow/engine/src/ProcessMaker/Model/ProcessVariablesTest.php
index b5da806a9..ee2b26edc 100644
--- a/tests/unit/workflow/engine/src/ProcessMaker/Model/ProcessVariablesTest.php
+++ b/tests/unit/workflow/engine/src/ProcessMaker/Model/ProcessVariablesTest.php
@@ -6,6 +6,9 @@ use ProcessMaker\Model\Process;
use ProcessMaker\Model\ProcessVariables;
use Tests\TestCase;
+/**
+ * @coversDefaultClass ProcessMaker\Model\ProcessVariables
+ */
class ProcessVariablesTest extends TestCase
{
/**
@@ -48,4 +51,23 @@ class ProcessVariablesTest extends TestCase
$this->assertEquals($process[0]['PRO_UID'], $result[0]['PRJ_UID']);
$this->assertEquals($process[0]['PRO_UID'], $result[1]['PRJ_UID']);
}
+
+ /**
+ * Test it return the variables related to the PRO_ID
+ *
+ * @covers \ProcessMaker\Model\ProcessVariables::getVariables()
+ * @test
+ */
+ public function it_list_variables_by_process()
+ {
+ $process = factory(Process::class)->create();
+
+ factory(ProcessVariables::class)->create([
+ 'PRJ_UID' => $process->PRO_UID,
+ 'PRO_ID' => $process->PRO_ID,
+ ]
+ );
+ $result = ProcessVariables::getVariables($process->PRO_ID);
+ $this->assertNotEmpty($result);
+ }
}
\ No newline at end of file
diff --git a/thirdparty/creole/Creole.php b/thirdparty/creole/Creole.php
index 72b5e1683..c3ffd7ea2 100644
--- a/thirdparty/creole/Creole.php
+++ b/thirdparty/creole/Creole.php
@@ -28,6 +28,8 @@ include_once 'creole/Connection.php';
@ini_set('track_errors', true);
+ use ProcessMaker\Core\System;
+
/**
* This is the class that manages the database drivers.
*
@@ -309,6 +311,10 @@ class Creole {
);
$info = parse_url($dsn);
+ if ($info === false) {
+ $info = System::parseUrlWithNotEncodedPassword($dsn);
+ }
+
$info['pass'] = urldecode($info['pass']);
if (count($info) === 1) { // if there's only one element in result, then it must be the phptype
$parsed['phptype'] = array_pop($info);
diff --git a/thirdparty/phing/Phing.php b/thirdparty/phing/Phing.php
index ca9ca7fd6..a44c4cfd8 100644
--- a/thirdparty/phing/Phing.php
+++ b/thirdparty/phing/Phing.php
@@ -1111,12 +1111,6 @@ class Phing {
ini_set('default_charset', 'iso-8859-1');
ini_set('register_globals', 'off');
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
- }
}
/**
diff --git a/workflow/engine/PmBootstrap.php b/workflow/engine/PmBootstrap.php
index 4745282c4..4f38b2eec 100644
--- a/workflow/engine/PmBootstrap.php
+++ b/workflow/engine/PmBootstrap.php
@@ -36,7 +36,6 @@ class PmBootstrap extends Bootstrap
ini_set('error_reporting', $e_all);
ini_set('short_open_tag', 'On');
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('date.timezone', (isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__'])? 'UTC' : $this->pmConfig['time_zone']); //Set Time Zone
diff --git a/workflow/engine/bin/cron.php b/workflow/engine/bin/cron.php
index 5aa50b485..7b552d923 100644
--- a/workflow/engine/bin/cron.php
+++ b/workflow/engine/bin/cron.php
@@ -101,7 +101,6 @@ try {
ini_set('error_reporting', $e_all);
ini_set('short_open_tag', 'On');
ini_set('default_charset', 'UTF-8');
- ini_set('memory_limit', $arraySystemConfiguration['memory_limit']);
ini_set('soap.wsdl_cache_enabled', $arraySystemConfiguration['wsdl_cache']);
ini_set('date.timezone', $systemUtcTimeZone ? 'UTC' : $arraySystemConfiguration['time_zone']);
diff --git a/workflow/engine/bin/cron_single.php b/workflow/engine/bin/cron_single.php
index 2306f622a..83c5fa260 100644
--- a/workflow/engine/bin/cron_single.php
+++ b/workflow/engine/bin/cron_single.php
@@ -95,7 +95,6 @@ try {
restore_error_handler();
// 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('error_reporting', $e_all);
ini_set('short_open_tag', 'On');
diff --git a/workflow/engine/bin/reindex_solr.php b/workflow/engine/bin/reindex_solr.php
index 67fe269d2..74f255211 100644
--- a/workflow/engine/bin/reindex_solr.php
+++ b/workflow/engine/bin/reindex_solr.php
@@ -87,8 +87,6 @@ if(count ($argv) > 3) {
$debug = 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_STRICT' ) ? $e_all & ~ E_STRICT : $e_all;
diff --git a/workflow/engine/bin/verify_solr.php b/workflow/engine/bin/verify_solr.php
index 043a8a3e8..6223b15d8 100644
--- a/workflow/engine/bin/verify_solr.php
+++ b/workflow/engine/bin/verify_solr.php
@@ -52,8 +52,6 @@ $debug = 1;//enable o disable notice, this mechanism is inherited from '/process
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_STRICT' ) ? $e_all & ~ E_STRICT : $e_all;
$e_all = $debug ? $e_all : $e_all & ~ E_NOTICE;
diff --git a/workflow/engine/classes/ActionsByEmailCoreClass.php b/workflow/engine/classes/ActionsByEmailCoreClass.php
index e3e579735..6c17e0266 100644
--- a/workflow/engine/classes/ActionsByEmailCoreClass.php
+++ b/workflow/engine/classes/ActionsByEmailCoreClass.php
@@ -437,18 +437,6 @@ class ActionsByEmailCoreClass extends PMPlugin
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
*
@@ -623,79 +611,94 @@ class ActionsByEmailCoreClass extends PMPlugin
self::validateAndSetValues($data);
$emailServerSetup = $this->getEmailServer($dataAbe['ABE_EMAIL_SERVER_UID']);
- if (!empty($emailServerSetup)) {
- $cases = new Cases();
- $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('/\
/', '', $__ABE__);
- $__ABE__ = preg_replace('/\]*\/>/', '', $__ABE__);
- $__ABE__ = preg_replace('/