Merged in release/3.3.13 (pull request #6946)
Updating branch develop with last changes from release/3.3.13 Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
@@ -4,16 +4,18 @@
|
|||||||
* Model factory for a dynaform.
|
* Model factory for a dynaform.
|
||||||
*/
|
*/
|
||||||
use Faker\Generator as Faker;
|
use Faker\Generator as Faker;
|
||||||
|
use ProcessMaker\Model\Dynaform;
|
||||||
|
use ProcessMaker\Model\Process;
|
||||||
|
|
||||||
$factory->define(\ProcessMaker\Model\Dynaform::class, function(Faker $faker) {
|
$factory->define(Dynaform::class, function(Faker $faker) {
|
||||||
$date = $faker->dateTime();
|
$date = $faker->dateTime();
|
||||||
return [
|
return [
|
||||||
'DYN_UID' => G::generateUniqueID(),
|
'DYN_UID' => G::generateUniqueID(),
|
||||||
'DYN_ID' => '',
|
'DYN_ID' => $faker->unique()->numberBetween(1, 10000),
|
||||||
'DYN_TITLE' => '',
|
'DYN_TITLE' => $faker->sentence(2),
|
||||||
'DYN_DESCRIPTION' => '',
|
'DYN_DESCRIPTION' => $faker->sentence(5),
|
||||||
'PRO_UID' => function() {
|
'PRO_UID' => function() {
|
||||||
$process = factory(\ProcessMaker\Model\Process::class)->create();
|
$process = factory(Process::class)->create();
|
||||||
return $process->PRO_UID;
|
return $process->PRO_UID;
|
||||||
},
|
},
|
||||||
'DYN_TYPE' => 'xmlform',
|
'DYN_TYPE' => 'xmlform',
|
||||||
|
|||||||
30
database/factories/InputDocumentFactory.php
Normal file
30
database/factories/InputDocumentFactory.php
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Model factory for a input document.
|
||||||
|
*/
|
||||||
|
use Faker\Generator as Faker;
|
||||||
|
use ProcessMaker\Model\InputDocument;
|
||||||
|
use ProcessMaker\Model\Process;
|
||||||
|
|
||||||
|
$factory->define(InputDocument::class, function(Faker $faker) {
|
||||||
|
return [
|
||||||
|
'INP_DOC_UID' => G::generateUniqueID(),
|
||||||
|
'INP_DOC_ID' => $faker->unique()->numberBetween(1, 10000),
|
||||||
|
'PRO_UID' => function() {
|
||||||
|
$process = factory(Process::class)->create();
|
||||||
|
return $process->PRO_UID;
|
||||||
|
},
|
||||||
|
'INP_DOC_TITLE' => $faker->sentence(2),
|
||||||
|
'INP_DOC_DESCRIPTION' => $faker->sentence(10),
|
||||||
|
'INP_DOC_FORM_NEEDED' => 'VIRTUAL',
|
||||||
|
'INP_DOC_ORIGINAL' => 'ORIGINAL',
|
||||||
|
'INP_DOC_PUBLISHED' => 'PRIVATE',
|
||||||
|
'INP_DOC_VERSIONING' => 0,
|
||||||
|
'INP_DOC_DESTINATION_PATH' => '',
|
||||||
|
'INP_DOC_TAGS' => 'INPUT',
|
||||||
|
'INP_DOC_TYPE_FILE' => '.*',
|
||||||
|
'INP_DOC_MAX_FILESIZE' => 0,
|
||||||
|
'INP_DOC_MAX_FILESIZE_UNIT' => 'KB'
|
||||||
|
];
|
||||||
|
});
|
||||||
43
database/factories/OutputDocumentFactory.php
Normal file
43
database/factories/OutputDocumentFactory.php
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Model factory for a output document.
|
||||||
|
*/
|
||||||
|
use Faker\Generator as Faker;
|
||||||
|
use ProcessMaker\Model\OutputDocument;
|
||||||
|
use ProcessMaker\Model\Process;
|
||||||
|
|
||||||
|
$factory->define(OutputDocument::class, function(Faker $faker) {
|
||||||
|
$date = $faker->dateTime();
|
||||||
|
return [
|
||||||
|
'OUT_DOC_UID' => G::generateUniqueID(),
|
||||||
|
'OUT_DOC_ID' => $faker->unique()->numberBetween(1, 10000),
|
||||||
|
'OUT_DOC_TITLE' => $faker->sentence(2),
|
||||||
|
'OUT_DOC_DESCRIPTION' => $faker->sentence(10),
|
||||||
|
'OUT_DOC_FILENAME' => $faker->sentence(2),
|
||||||
|
'OUT_DOC_TEMPLATE' => '',
|
||||||
|
'PRO_UID' => function() {
|
||||||
|
$process = factory(Process::class)->create();
|
||||||
|
return $process->PRO_UID;
|
||||||
|
},
|
||||||
|
'OUT_DOC_REPORT_GENERATOR' => 'TCPDF',
|
||||||
|
'OUT_DOC_LANDSCAPE' => 0,
|
||||||
|
'OUT_DOC_MEDIA' => 'Letter',
|
||||||
|
'OUT_DOC_LEFT_MARGIN' => 20,
|
||||||
|
'OUT_DOC_RIGHT_MARGIN' => 20,
|
||||||
|
'OUT_DOC_TOP_MARGIN' => 20,
|
||||||
|
'OUT_DOC_BOTTOM_MARGIN' => 20,
|
||||||
|
'OUT_DOC_GENERATE' => 'BOTH',
|
||||||
|
'OUT_DOC_TYPE' => 'HTML',
|
||||||
|
'OUT_DOC_CURRENT_REVISION' => 0,
|
||||||
|
'OUT_DOC_FIELD_MAPPING' => '',
|
||||||
|
'OUT_DOC_VERSIONING' => 1,
|
||||||
|
'OUT_DOC_DESTINATION_PATH' => '',
|
||||||
|
'OUT_DOC_TAGS' => '',
|
||||||
|
'OUT_DOC_PDF_SECURITY_ENABLED' => 0,
|
||||||
|
'OUT_DOC_PDF_SECURITY_OPEN_PASSWORD' => '',
|
||||||
|
'OUT_DOC_PDF_SECURITY_OWNER_PASSWORD' => '',
|
||||||
|
'OUT_DOC_PDF_SECURITY_PERMISSIONS' => '',
|
||||||
|
'OUT_DOC_OPEN_TYPE' => 1
|
||||||
|
];
|
||||||
|
});
|
||||||
@@ -1639,7 +1639,7 @@ class G
|
|||||||
* @param string $sqlString The string to be escaped
|
* @param string $sqlString The string to be escaped
|
||||||
* @param string $DBEngine Target DBMS
|
* @param string $DBEngine Target DBMS
|
||||||
*/
|
*/
|
||||||
public function sqlEscape($sqlString, $DBEngine = DB_ADAPTER)
|
public static function sqlEscape($sqlString, $DBEngine = DB_ADAPTER)
|
||||||
{
|
{
|
||||||
$DBEngine = DB_ADAPTER;
|
$DBEngine = DB_ADAPTER;
|
||||||
switch ($DBEngine) {
|
switch ($DBEngine) {
|
||||||
@@ -1748,12 +1748,12 @@ class G
|
|||||||
}
|
}
|
||||||
//Non-quoted
|
//Non-quoted
|
||||||
if (($match[1][$r][0] == '#') && (isset($result[$match[2][$r][0]]))) {
|
if (($match[1][$r][0] == '#') && (isset($result[$match[2][$r][0]]))) {
|
||||||
$__textoEval .= G::replaceDataField($result[$match[2][$r][0]], $result);
|
$__textoEval .= $result[$match[2][$r][0]];
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//Non-quoted =
|
//Non-quoted =
|
||||||
if (($match[1][$r][0] == '=') && (isset($result[$match[2][$r][0]]))) {
|
if (($match[1][$r][0] == '=') && (isset($result[$match[2][$r][0]]))) {
|
||||||
$__textoEval .= G::replaceDataField($result[$match[2][$r][0]], $result);
|
$__textoEval .= $result[$match[2][$r][0]];
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//Objects attributes
|
//Objects attributes
|
||||||
|
|||||||
96
tests/unit/gulliver/system/ReplaceDataFieldTest.php
Normal file
96
tests/unit/gulliver/system/ReplaceDataFieldTest.php
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class ReplaceDataFieldTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Check that the value of "@q" followed by a string is not being set as empty when using "@#" to identify a variable
|
||||||
|
*
|
||||||
|
* @test
|
||||||
|
* @covers G::replaceDataField
|
||||||
|
*/
|
||||||
|
public function it_should_not_set_empty_when_calling_a_variable_with_hashtag_symbol()
|
||||||
|
{
|
||||||
|
$string = '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>THIS IS ONLY A TEST OF THE VARIABLE @#var_supplierEmail </p>
|
||||||
|
</body>
|
||||||
|
</html>';
|
||||||
|
|
||||||
|
$result = [
|
||||||
|
'var_supplierEmail' => 'asa@qq.fds',
|
||||||
|
'var_supplierEmail_label' => 'asa@qq.fds',
|
||||||
|
];
|
||||||
|
|
||||||
|
$dbEngine = 'mysql';
|
||||||
|
|
||||||
|
// Replace variables in the string
|
||||||
|
$stringToCheck = G::replaceDataField($string, $result, $dbEngine);
|
||||||
|
|
||||||
|
// Assert the @qq is not being set as an empty value
|
||||||
|
$this->assertRegExp("/asa@qq.fds/", $stringToCheck);
|
||||||
|
|
||||||
|
// Testing with a "@qstring" value
|
||||||
|
$result = [
|
||||||
|
'var_supplierEmail' => '@qstring',
|
||||||
|
'var_supplierEmail_label' => '@qstring',
|
||||||
|
];
|
||||||
|
|
||||||
|
$dbEngine = 'mysql';
|
||||||
|
|
||||||
|
// Replace variables in the string
|
||||||
|
$stringToCheck = G::replaceDataField($string, $result, $dbEngine);
|
||||||
|
|
||||||
|
// Assert the @qstring is not being set as an empty value
|
||||||
|
$this->assertRegExp("/@qstring/", $stringToCheck);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check that the value of "@q" followed by a string is not being set as empty when using "@=" to identify a variable
|
||||||
|
*
|
||||||
|
* @test
|
||||||
|
* @covers G::replaceDataField
|
||||||
|
*/
|
||||||
|
public function it_should_not_set_empty_when_calling_a_variable_with_equals_symbol()
|
||||||
|
{
|
||||||
|
$string = '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>THIS IS ONLY A TEST OF THE VARIABLE @=var_supplierEmail </p>
|
||||||
|
</body>
|
||||||
|
</html>';
|
||||||
|
|
||||||
|
$result = [
|
||||||
|
'var_supplierEmail' => 'asa@qq.fds',
|
||||||
|
'var_supplierEmail_label' => 'asa@qq.fds',
|
||||||
|
];
|
||||||
|
|
||||||
|
$dbEngine = 'mysql';
|
||||||
|
|
||||||
|
// Replace variables in the string
|
||||||
|
$stringToCheck = G::replaceDataField($string, $result, $dbEngine);
|
||||||
|
|
||||||
|
// Assert the @qq is not being set as an empty value
|
||||||
|
$this->assertRegExp("/asa@qq.fds/", $stringToCheck);
|
||||||
|
|
||||||
|
// Testing with a "@qstring" value
|
||||||
|
$result = [
|
||||||
|
'var_supplierEmail' => '@qstring',
|
||||||
|
'var_supplierEmail_label' => '@qstring',
|
||||||
|
];
|
||||||
|
|
||||||
|
$dbEngine = 'mysql';
|
||||||
|
|
||||||
|
// Replace variables in the string
|
||||||
|
$stringToCheck = G::replaceDataField($string, $result, $dbEngine);
|
||||||
|
|
||||||
|
// Assert the @qstring is not being set as an empty value
|
||||||
|
$this->assertRegExp("/@qstring/", $stringToCheck);
|
||||||
|
}
|
||||||
|
}
|
||||||
419
tests/unit/workflow/engine/classes/ProcessesTest.php
Normal file
419
tests/unit/workflow/engine/classes/ProcessesTest.php
Normal file
@@ -0,0 +1,419 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\unit\workflow\engine\classes;
|
||||||
|
|
||||||
|
use Faker\Factory;
|
||||||
|
use G;
|
||||||
|
use Processes;
|
||||||
|
use ProcessMaker\Model\Dynaform;
|
||||||
|
use ProcessMaker\Model\InputDocument;
|
||||||
|
use ProcessMaker\Model\OutputDocument;
|
||||||
|
use ProcessMaker\Model\Process;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class ProcessesTest extends TestCase
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is using instead of DatabaseTransactions
|
||||||
|
* @todo DatabaseTransactions is having conflicts with propel
|
||||||
|
*/
|
||||||
|
protected function setUp()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort array of array by column.
|
||||||
|
* @param array $data
|
||||||
|
* @param string $columnName
|
||||||
|
*/
|
||||||
|
public function sortArrayByColumn(&$data, $columnName)
|
||||||
|
{
|
||||||
|
usort($data, function($a, $b) use($columnName) {
|
||||||
|
return strnatcmp($a[$columnName], $b[$columnName]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This checks if the returned dynaforms are correct with the different parameters.
|
||||||
|
* @test
|
||||||
|
* @covers \Processes::getDynaformRows()
|
||||||
|
*/
|
||||||
|
public function it_should_return_dynaforms()
|
||||||
|
{
|
||||||
|
$process = factory(Process::class)->create()->first();
|
||||||
|
$proUid = $process->PRO_UID;
|
||||||
|
|
||||||
|
$dynaforms = factory(Dynaform::class, 6)
|
||||||
|
->create([
|
||||||
|
'PRO_UID' => $proUid
|
||||||
|
])
|
||||||
|
->sortBy('DYN_UID')
|
||||||
|
->values();
|
||||||
|
|
||||||
|
//test with parameter false
|
||||||
|
$expected = $dynaforms->toArray();
|
||||||
|
|
||||||
|
$processes = new Processes();
|
||||||
|
$actual = $processes->getDynaformRows($proUid, false);
|
||||||
|
$this->sortArrayByColumn($actual, 'DYN_UID');
|
||||||
|
|
||||||
|
$this->assertEquals($expected, $actual);
|
||||||
|
|
||||||
|
//by default the method getDynaformRows removed DYN_ID column
|
||||||
|
$dynaforms->transform(function($item, $key) {
|
||||||
|
unset($item->DYN_ID);
|
||||||
|
return $item;
|
||||||
|
});
|
||||||
|
|
||||||
|
//test with parameter default
|
||||||
|
$expected = $dynaforms->toArray();
|
||||||
|
|
||||||
|
$processes = new Processes();
|
||||||
|
$actual = $processes->getDynaformRows($proUid);
|
||||||
|
$this->sortArrayByColumn($actual, 'DYN_UID');
|
||||||
|
|
||||||
|
$this->assertEquals($expected, $actual);
|
||||||
|
|
||||||
|
//test with parameter true
|
||||||
|
$expected = $dynaforms->toArray();
|
||||||
|
|
||||||
|
$processes = new Processes();
|
||||||
|
$actual = $processes->getDynaformRows($proUid, true);
|
||||||
|
$this->sortArrayByColumn($actual, 'DYN_UID');
|
||||||
|
|
||||||
|
$this->assertEquals($expected, $actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This check if the returned input documents are correct with the different
|
||||||
|
* parameters.
|
||||||
|
* @test
|
||||||
|
* @covers \Processes::getInputRows()
|
||||||
|
*/
|
||||||
|
public function it_should_return_input_documents()
|
||||||
|
{
|
||||||
|
$process = factory(Process::class)->create()->first();
|
||||||
|
$proUid = $process->PRO_UID;
|
||||||
|
|
||||||
|
$inputDocument = factory(InputDocument::class, 6)
|
||||||
|
->create([
|
||||||
|
'PRO_UID' => $proUid
|
||||||
|
])
|
||||||
|
->sortBy('INP_DOC_UID')
|
||||||
|
->values();
|
||||||
|
|
||||||
|
//test with parameter false
|
||||||
|
$expected = $inputDocument->toArray();
|
||||||
|
|
||||||
|
$processes = new Processes();
|
||||||
|
$actual = $processes->getInputRows($proUid, false);
|
||||||
|
$this->sortArrayByColumn($actual, 'INP_DOC_UID');
|
||||||
|
|
||||||
|
$this->assertEquals($expected, $actual);
|
||||||
|
|
||||||
|
//by default the mnethod getInputRows removed INP_DOC_ID column
|
||||||
|
$inputDocument->transform(function($item, $key) {
|
||||||
|
unset($item->INP_DOC_ID);
|
||||||
|
return $item;
|
||||||
|
});
|
||||||
|
|
||||||
|
//test with parameter default
|
||||||
|
$expected = $inputDocument->toArray();
|
||||||
|
|
||||||
|
$processes = new Processes();
|
||||||
|
$actual = $processes->getInputRows($proUid);
|
||||||
|
$this->sortArrayByColumn($actual, 'INP_DOC_UID');
|
||||||
|
|
||||||
|
$this->assertEquals($expected, $actual);
|
||||||
|
|
||||||
|
//test with the parameter true
|
||||||
|
$expected = $inputDocument->toArray();
|
||||||
|
|
||||||
|
$processes = new Processes();
|
||||||
|
$actual = $processes->getInputRows($proUid, true);
|
||||||
|
$this->sortArrayByColumn($actual, 'INP_DOC_UID');
|
||||||
|
|
||||||
|
$this->assertEquals($expected, $actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This checks fi the returned output documents are correct with the differect
|
||||||
|
* parameters.
|
||||||
|
* @test
|
||||||
|
* @covers Processes::getOutputRows()
|
||||||
|
*/
|
||||||
|
public function it_should_return_output_documents()
|
||||||
|
{
|
||||||
|
$process = factory(Process::class)->create()->first();
|
||||||
|
$proUid = $process->PRO_UID;
|
||||||
|
|
||||||
|
$outputDocument = factory(OutputDocument::class, 6)
|
||||||
|
->create([
|
||||||
|
'PRO_UID' => $proUid
|
||||||
|
])
|
||||||
|
->sortBy('OUT_DOC_UID')
|
||||||
|
->values();
|
||||||
|
|
||||||
|
//test with parameter false
|
||||||
|
$expected = $outputDocument->toArray();
|
||||||
|
|
||||||
|
$processes = new Processes();
|
||||||
|
$actual = $processes->getOutputRows($proUid, false);
|
||||||
|
$this->sortArrayByColumn($actual, 'OUT_DOC_UID');
|
||||||
|
|
||||||
|
$this->assertEquals($expected, $actual);
|
||||||
|
|
||||||
|
//by default the method getOutoutRows removed OUT_DOC_ID column
|
||||||
|
$outputDocument->transform(function($item, $key) {
|
||||||
|
unset($item->OUT_DOC_ID);
|
||||||
|
return $item;
|
||||||
|
});
|
||||||
|
|
||||||
|
//test with parameter default
|
||||||
|
$expected = $outputDocument->toArray();
|
||||||
|
|
||||||
|
$processes = new Processes();
|
||||||
|
$actual = $processes->getOutputRows($proUid);
|
||||||
|
$this->sortArrayByColumn($actual, 'OUT_DOC_UID');
|
||||||
|
|
||||||
|
$this->assertEquals($expected, $actual);
|
||||||
|
|
||||||
|
//test with parameter true
|
||||||
|
$expected = $outputDocument->toArray();
|
||||||
|
|
||||||
|
$processes = new Processes();
|
||||||
|
$actual = $processes->getOutputRows($proUid, true);
|
||||||
|
$this->sortArrayByColumn($actual, 'OUT_DOC_UID');
|
||||||
|
|
||||||
|
$this->assertEquals($expected, $actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This checks if the dynaforms structure is saved with the different parameters.
|
||||||
|
* @test
|
||||||
|
* @covers Processes::createDynaformRows()
|
||||||
|
*/
|
||||||
|
public function it_sholud_create_dynaform()
|
||||||
|
{
|
||||||
|
$faker = Factory::create();
|
||||||
|
$date = $faker->datetime();
|
||||||
|
$proUid = G::generateUniqueID();
|
||||||
|
$expected = [
|
||||||
|
[
|
||||||
|
'DYN_ID' => $faker->unique()->numberBetween(1, 10000000),
|
||||||
|
'DYN_UID' => G::generateUniqueID(),
|
||||||
|
'DYN_TITLE' => $faker->sentence(2),
|
||||||
|
'DYN_DESCRIPTION' => $faker->sentence(5),
|
||||||
|
'PRO_UID' => $proUid,
|
||||||
|
'DYN_TYPE' => 'xmlform',
|
||||||
|
'DYN_FILENAME' => '',
|
||||||
|
'DYN_CONTENT' => '',
|
||||||
|
'DYN_LABEL' => '',
|
||||||
|
'DYN_VERSION' => 2,
|
||||||
|
'DYN_UPDATE_DATE' => $date->format('Y-m-d H:i:s'),
|
||||||
|
'__DYN_ID_UPDATE__' => false,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'DYN_ID' => $faker->unique()->numberBetween(1, 10000000),
|
||||||
|
'DYN_UID' => G::generateUniqueID(),
|
||||||
|
'DYN_TITLE' => $faker->sentence(2),
|
||||||
|
'DYN_DESCRIPTION' => $faker->sentence(5),
|
||||||
|
'PRO_UID' => $proUid,
|
||||||
|
'DYN_TYPE' => 'xmlform',
|
||||||
|
'DYN_FILENAME' => '',
|
||||||
|
'DYN_CONTENT' => '',
|
||||||
|
'DYN_LABEL' => '',
|
||||||
|
'DYN_VERSION' => 2,
|
||||||
|
'DYN_UPDATE_DATE' => $date->format('Y-m-d H:i:s'),
|
||||||
|
'__DYN_ID_UPDATE__' => false,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
$this->sortArrayByColumn($expected, 'DYN_UID');
|
||||||
|
|
||||||
|
$processes = new Processes();
|
||||||
|
$processes->createDynaformRows($expected);
|
||||||
|
foreach ($expected as &$value) {
|
||||||
|
ksort($value);
|
||||||
|
unset($value['__DYN_ID_UPDATE__']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$dynaforms = Dynaform::getByProUid($proUid)
|
||||||
|
->sortBy('DYN_UID')
|
||||||
|
->values();
|
||||||
|
$dynaforms->transform(function($item, $key) {
|
||||||
|
return (array) $item;
|
||||||
|
});
|
||||||
|
$actual = $dynaforms->toArray();
|
||||||
|
foreach ($actual as $value) {
|
||||||
|
ksort($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->assertEquals($expected, $actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This checks if the input documents structure is saved with the different
|
||||||
|
* parameters.
|
||||||
|
* @test
|
||||||
|
* @covers Processes::createInputRows()
|
||||||
|
*/
|
||||||
|
public function it_should_create_input_document()
|
||||||
|
{
|
||||||
|
$faker = Factory::create();
|
||||||
|
$date = $faker->datetime();
|
||||||
|
$proUid = G::generateUniqueID();
|
||||||
|
$expected = [
|
||||||
|
[
|
||||||
|
'INP_DOC_UID' => G::generateUniqueID(),
|
||||||
|
'INP_DOC_ID' => $faker->unique()->numberBetween(1, 10000),
|
||||||
|
'PRO_UID' => $proUid,
|
||||||
|
'INP_DOC_TITLE' => $faker->sentence(2),
|
||||||
|
'INP_DOC_DESCRIPTION' => $faker->sentence(10),
|
||||||
|
'INP_DOC_FORM_NEEDED' => 'VIRTUAL',
|
||||||
|
'INP_DOC_ORIGINAL' => 'ORIGINAL',
|
||||||
|
'INP_DOC_PUBLISHED' => 'PRIVATE',
|
||||||
|
'INP_DOC_VERSIONING' => 0,
|
||||||
|
'INP_DOC_DESTINATION_PATH' => '',
|
||||||
|
'INP_DOC_TAGS' => 'INPUT',
|
||||||
|
'INP_DOC_TYPE_FILE' => '.*',
|
||||||
|
'INP_DOC_MAX_FILESIZE' => 0,
|
||||||
|
'INP_DOC_MAX_FILESIZE_UNIT' => 'KB',
|
||||||
|
'__INP_DOC_ID_UPDATE__' => false,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'INP_DOC_UID' => G::generateUniqueID(),
|
||||||
|
'INP_DOC_ID' => $faker->unique()->numberBetween(1, 10000),
|
||||||
|
'PRO_UID' => $proUid,
|
||||||
|
'INP_DOC_TITLE' => $faker->sentence(2),
|
||||||
|
'INP_DOC_DESCRIPTION' => $faker->sentence(10),
|
||||||
|
'INP_DOC_FORM_NEEDED' => 'VIRTUAL',
|
||||||
|
'INP_DOC_ORIGINAL' => 'ORIGINAL',
|
||||||
|
'INP_DOC_PUBLISHED' => 'PRIVATE',
|
||||||
|
'INP_DOC_VERSIONING' => 0,
|
||||||
|
'INP_DOC_DESTINATION_PATH' => '',
|
||||||
|
'INP_DOC_TAGS' => 'INPUT',
|
||||||
|
'INP_DOC_TYPE_FILE' => '.*',
|
||||||
|
'INP_DOC_MAX_FILESIZE' => 0,
|
||||||
|
'INP_DOC_MAX_FILESIZE_UNIT' => 'KB',
|
||||||
|
'__INP_DOC_ID_UPDATE__' => false,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
$this->sortArrayByColumn($expected, 'INP_DOC_UID');
|
||||||
|
|
||||||
|
$processes = new Processes();
|
||||||
|
$processes->createInputRows($expected);
|
||||||
|
foreach ($expected as &$value) {
|
||||||
|
ksort($value);
|
||||||
|
unset($value['__INP_DOC_ID_UPDATE__']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$inputDocuments = InputDocument::getByProUid($proUid)
|
||||||
|
->sortBy('INP_DOC_UID')
|
||||||
|
->values();
|
||||||
|
$inputDocuments->transform(function($item, $key) {
|
||||||
|
return $item->attributesToArray();
|
||||||
|
});
|
||||||
|
$actual = $inputDocuments->toArray();
|
||||||
|
foreach ($actual as &$value) {
|
||||||
|
ksort($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->assertEquals($expected, $actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This checks if the output documents structure is saved with the different
|
||||||
|
* parameters.
|
||||||
|
* @test
|
||||||
|
* @covers Processes::createOutputRows()
|
||||||
|
*/
|
||||||
|
public function it_should_create_output_document()
|
||||||
|
{
|
||||||
|
$faker = Factory::create();
|
||||||
|
$date = $faker->datetime();
|
||||||
|
$proUid = G::generateUniqueID();
|
||||||
|
$expected = [
|
||||||
|
[
|
||||||
|
'OUT_DOC_UID' => G::generateUniqueID(),
|
||||||
|
'OUT_DOC_ID' => $faker->unique()->numberBetween(1, 10000),
|
||||||
|
'OUT_DOC_TITLE' => $faker->sentence(2),
|
||||||
|
'OUT_DOC_DESCRIPTION' => $faker->sentence(10),
|
||||||
|
'OUT_DOC_FILENAME' => $faker->sentence(2),
|
||||||
|
'OUT_DOC_TEMPLATE' => '',
|
||||||
|
'PRO_UID' => $proUid,
|
||||||
|
'OUT_DOC_REPORT_GENERATOR' => 'TCPDF',
|
||||||
|
'OUT_DOC_LANDSCAPE' => 0,
|
||||||
|
'OUT_DOC_MEDIA' => 'Letter',
|
||||||
|
'OUT_DOC_LEFT_MARGIN' => 20,
|
||||||
|
'OUT_DOC_RIGHT_MARGIN' => 20,
|
||||||
|
'OUT_DOC_TOP_MARGIN' => 20,
|
||||||
|
'OUT_DOC_BOTTOM_MARGIN' => 20,
|
||||||
|
'OUT_DOC_GENERATE' => 'BOTH',
|
||||||
|
'OUT_DOC_TYPE' => 'HTML',
|
||||||
|
'OUT_DOC_CURRENT_REVISION' => 0,
|
||||||
|
'OUT_DOC_FIELD_MAPPING' => '',
|
||||||
|
'OUT_DOC_VERSIONING' => 1,
|
||||||
|
'OUT_DOC_DESTINATION_PATH' => '',
|
||||||
|
'OUT_DOC_TAGS' => '',
|
||||||
|
'OUT_DOC_PDF_SECURITY_ENABLED' => 0,
|
||||||
|
'OUT_DOC_PDF_SECURITY_OPEN_PASSWORD' => '',
|
||||||
|
'OUT_DOC_PDF_SECURITY_OWNER_PASSWORD' => '',
|
||||||
|
'OUT_DOC_PDF_SECURITY_PERMISSIONS' => '',
|
||||||
|
'OUT_DOC_OPEN_TYPE' => 1,
|
||||||
|
'__OUT_DOC_ID_UPDATE__' => false,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'OUT_DOC_UID' => G::generateUniqueID(),
|
||||||
|
'OUT_DOC_ID' => $faker->unique()->numberBetween(1, 10000),
|
||||||
|
'OUT_DOC_TITLE' => $faker->sentence(2),
|
||||||
|
'OUT_DOC_DESCRIPTION' => $faker->sentence(10),
|
||||||
|
'OUT_DOC_FILENAME' => $faker->sentence(2),
|
||||||
|
'OUT_DOC_TEMPLATE' => '',
|
||||||
|
'PRO_UID' => $proUid,
|
||||||
|
'OUT_DOC_REPORT_GENERATOR' => 'TCPDF',
|
||||||
|
'OUT_DOC_LANDSCAPE' => 0,
|
||||||
|
'OUT_DOC_MEDIA' => 'Letter',
|
||||||
|
'OUT_DOC_LEFT_MARGIN' => 20,
|
||||||
|
'OUT_DOC_RIGHT_MARGIN' => 20,
|
||||||
|
'OUT_DOC_TOP_MARGIN' => 20,
|
||||||
|
'OUT_DOC_BOTTOM_MARGIN' => 20,
|
||||||
|
'OUT_DOC_GENERATE' => 'BOTH',
|
||||||
|
'OUT_DOC_TYPE' => 'HTML',
|
||||||
|
'OUT_DOC_CURRENT_REVISION' => 0,
|
||||||
|
'OUT_DOC_FIELD_MAPPING' => '',
|
||||||
|
'OUT_DOC_VERSIONING' => 1,
|
||||||
|
'OUT_DOC_DESTINATION_PATH' => '',
|
||||||
|
'OUT_DOC_TAGS' => '',
|
||||||
|
'OUT_DOC_PDF_SECURITY_ENABLED' => 0,
|
||||||
|
'OUT_DOC_PDF_SECURITY_OPEN_PASSWORD' => '',
|
||||||
|
'OUT_DOC_PDF_SECURITY_OWNER_PASSWORD' => '',
|
||||||
|
'OUT_DOC_PDF_SECURITY_PERMISSIONS' => '',
|
||||||
|
'OUT_DOC_OPEN_TYPE' => 1,
|
||||||
|
'__OUT_DOC_ID_UPDATE__' => false,
|
||||||
|
]
|
||||||
|
];
|
||||||
|
$this->sortArrayByColumn($expected, 'OUT_DOC_UID');
|
||||||
|
|
||||||
|
$processes = new Processes();
|
||||||
|
$processes->createOutputRows($expected);
|
||||||
|
foreach ($expected as &$value) {
|
||||||
|
ksort($value);
|
||||||
|
unset($value['__OUT_DOC_ID_UPDATE__']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$outputDocuments = OutputDocument::getByProUid($proUid)
|
||||||
|
->sortBy('OUT_DOC_UID')
|
||||||
|
->values();
|
||||||
|
$outputDocuments->transform(function($item, $key) {
|
||||||
|
return $item->attributestoArray();
|
||||||
|
});
|
||||||
|
$actual = $outputDocuments->toArray();
|
||||||
|
foreach ($actual as &$value) {
|
||||||
|
ksort($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->assertEquals($expected, $actual);
|
||||||
|
}
|
||||||
|
}
|
||||||
68
tests/unit/workflow/engine/classes/SpoolRunTest.php
Normal file
68
tests/unit/workflow/engine/classes/SpoolRunTest.php
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Faker\Factory;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class SpoolRunTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Constructor of the class.
|
||||||
|
*/
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if "envelope_cc" and "envelope_bcc" was set correctly in consecutive calls
|
||||||
|
*
|
||||||
|
* @covers SpoolRun::setData()
|
||||||
|
*
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function it_should_check_if_cc_and_bcc_set_correctly_in_consecutive_calls()
|
||||||
|
{
|
||||||
|
// Initializing Faker instance
|
||||||
|
$faker = Factory::create();
|
||||||
|
|
||||||
|
// Instancing SpoolRun class
|
||||||
|
$spoolRun = new SpoolRun();
|
||||||
|
|
||||||
|
// Set a first set of data
|
||||||
|
$spoolRun->setData(
|
||||||
|
G::generateUniqueID(),
|
||||||
|
$faker->words(3, true),
|
||||||
|
$faker->companyEmail,
|
||||||
|
$faker->freeEmail,
|
||||||
|
$faker->text(),
|
||||||
|
$faker->dateTime()->format('Y-m-d H:i:s'),
|
||||||
|
$faker->companyEmail,
|
||||||
|
$faker->freeEmail
|
||||||
|
);
|
||||||
|
|
||||||
|
// Build the "to", "cc" an "bcc" values
|
||||||
|
$spoolRun->runHandleEnvelopeTo();
|
||||||
|
|
||||||
|
// Set a second set of data
|
||||||
|
$spoolRun->setData(
|
||||||
|
G::generateUniqueID(),
|
||||||
|
$faker->words(3, true),
|
||||||
|
$faker->companyEmail,
|
||||||
|
$faker->freeEmail,
|
||||||
|
$faker->text(),
|
||||||
|
$faker->dateTime()->format('Y-m-d H:i:s'),
|
||||||
|
$faker->companyEmail,
|
||||||
|
$faker->freeEmail
|
||||||
|
);
|
||||||
|
|
||||||
|
// Build the "to", "cc" an "bcc" values
|
||||||
|
$spoolRun->runHandleEnvelopeTo();
|
||||||
|
|
||||||
|
// Get data to check
|
||||||
|
$fileData = $spoolRun->getFileData();
|
||||||
|
|
||||||
|
// Asserts
|
||||||
|
$this->assertCount(1, $fileData['envelope_to']);
|
||||||
|
$this->assertCount(1, $fileData['envelope_cc']);
|
||||||
|
$this->assertCount(1, $fileData['envelope_bcc']);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1919,14 +1919,19 @@ class Processes
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets Input Documents Rows from aProcess.
|
* Gets Input Documents Rows from process.
|
||||||
*
|
*
|
||||||
* @param string $proUid
|
* @param string $proUid
|
||||||
|
* @param boolean $unsetInpDocId
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
*
|
||||||
|
* @see Processes::getWorkflowData()
|
||||||
|
* @see ProcessMaker\BusinessModel\Migrator\InputDocumentsMigrator::export()
|
||||||
|
* @see ProcessMaker\Importer\Importer::saveCurrentProcess()
|
||||||
*/
|
*/
|
||||||
public function getInputRows($proUid)
|
public function getInputRows($proUid, $unsetInpDocId = true)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$inputList = [];
|
$inputList = [];
|
||||||
@@ -1938,7 +1943,9 @@ class Processes
|
|||||||
while ($row = $dataset->getRow()) {
|
while ($row = $dataset->getRow()) {
|
||||||
$input = new InputDocument();
|
$input = new InputDocument();
|
||||||
$infoInput = $input->load($row['INP_DOC_UID']);
|
$infoInput = $input->load($row['INP_DOC_UID']);
|
||||||
unset($infoInput['INP_DOC_ID']);
|
if ($unsetInpDocId === true) {
|
||||||
|
unset($infoInput['INP_DOC_ID']);
|
||||||
|
}
|
||||||
$inputList[] = $infoInput;
|
$inputList[] = $infoInput;
|
||||||
$dataset->next();
|
$dataset->next();
|
||||||
}
|
}
|
||||||
@@ -1956,6 +1963,10 @@ class Processes
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
*
|
||||||
|
* @see Processes::createProcessPropertiesFromData()
|
||||||
|
* @see Processes::updateProcessFromData()
|
||||||
|
* @see ProcessMaker\BusinessModel\Migrator\InputDocumentsMigrator::import()
|
||||||
*/
|
*/
|
||||||
public function createInputRows($input)
|
public function createInputRows($input)
|
||||||
{
|
{
|
||||||
@@ -1970,11 +1981,15 @@ class Processes
|
|||||||
//Get the INP_DOC_ID column
|
//Get the INP_DOC_ID column
|
||||||
$dataSet = BasePeer::doSelect($criteria, $con);
|
$dataSet = BasePeer::doSelect($criteria, $con);
|
||||||
$dataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
$dataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
if ($dataSet->next()) {
|
if (isset($row["__INP_DOC_ID_UPDATE__"]) && $row["__INP_DOC_ID_UPDATE__"] === false) {
|
||||||
$inputInfo = $dataSet->getRow();
|
unset($row["__INP_DOC_ID_UPDATE__"]);
|
||||||
$row['INP_DOC_ID'] = $inputInfo['INP_DOC_ID'];
|
|
||||||
} else {
|
} else {
|
||||||
$row['INP_DOC_ID'] = null;
|
if ($dataSet->next()) {
|
||||||
|
$inputInfo = $dataSet->getRow();
|
||||||
|
$row['INP_DOC_ID'] = $inputInfo['INP_DOC_ID'];
|
||||||
|
} else {
|
||||||
|
$row['INP_DOC_ID'] = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
BasePeer::doDelete($criteria, $con);
|
BasePeer::doDelete($criteria, $con);
|
||||||
//Prepare the insert
|
//Prepare the insert
|
||||||
@@ -2102,11 +2117,16 @@ class Processes
|
|||||||
* Gets the Output Documents Rows from a Process.
|
* Gets the Output Documents Rows from a Process.
|
||||||
*
|
*
|
||||||
* @param string $proUid
|
* @param string $proUid
|
||||||
|
* @param boolean $unsetOutDocId
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
*
|
||||||
|
* @see Processes::getWorkflowData()
|
||||||
|
* @see ProcessMaker\BusinessModel\Migrator\OutputDocumentsMigrator::export()
|
||||||
|
* @see ProcessMaker\Importer\Importer::saveCurrentProcess()
|
||||||
*/
|
*/
|
||||||
public function getOutputRows($proUid)
|
public function getOutputRows($proUid, $unsetOutDocId = true)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$outputList = [];
|
$outputList = [];
|
||||||
@@ -2118,7 +2138,9 @@ class Processes
|
|||||||
while ($row = $dataset->getRow()) {
|
while ($row = $dataset->getRow()) {
|
||||||
$output = new OutputDocument();
|
$output = new OutputDocument();
|
||||||
$infoOutput = $output->Load($row['OUT_DOC_UID']);
|
$infoOutput = $output->Load($row['OUT_DOC_UID']);
|
||||||
unset($infoOutput['OUT_DOC_ID']);
|
if ($unsetOutDocId === true) {
|
||||||
|
unset($infoOutput['OUT_DOC_ID']);
|
||||||
|
}
|
||||||
$outputList[] = $infoOutput;
|
$outputList[] = $infoOutput;
|
||||||
$dataset->next();
|
$dataset->next();
|
||||||
}
|
}
|
||||||
@@ -2136,6 +2158,10 @@ class Processes
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
*
|
||||||
|
* @see Processes::createProcessPropertiesFromData()
|
||||||
|
* @see Processes::updateProcessFromData()
|
||||||
|
* @see ProcessMaker\BusinessModel\Migrator\OutputDocumentsMigrator::import()
|
||||||
*/
|
*/
|
||||||
public function createOutputRows($output)
|
public function createOutputRows($output)
|
||||||
{
|
{
|
||||||
@@ -2150,11 +2176,15 @@ class Processes
|
|||||||
//Get the OUT_DOC_ID column
|
//Get the OUT_DOC_ID column
|
||||||
$dataSet = BasePeer::doSelect($criteria, $con);
|
$dataSet = BasePeer::doSelect($criteria, $con);
|
||||||
$dataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
$dataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
if ($dataSet->next()) {
|
if (isset($row["__OUT_DOC_ID_UPDATE__"]) && $row["__OUT_DOC_ID_UPDATE__"] === false) {
|
||||||
$outputInfo = $dataSet->getRow();
|
unset($row["__OUT_DOC_ID_UPDATE__"]);
|
||||||
$row['OUT_DOC_ID'] = $outputInfo['OUT_DOC_ID'];
|
|
||||||
} else {
|
} else {
|
||||||
$row['OUT_DOC_ID'] = null;
|
if ($dataSet->next()) {
|
||||||
|
$outputInfo = $dataSet->getRow();
|
||||||
|
$row['OUT_DOC_ID'] = $outputInfo['OUT_DOC_ID'];
|
||||||
|
} else {
|
||||||
|
$row['OUT_DOC_ID'] = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
BasePeer::doDelete($criteria, $con);
|
BasePeer::doDelete($criteria, $con);
|
||||||
//Prepare the insert
|
//Prepare the insert
|
||||||
@@ -2931,11 +2961,16 @@ class Processes
|
|||||||
* Get Dynaform Rows from a Process
|
* Get Dynaform Rows from a Process
|
||||||
*
|
*
|
||||||
* @param string $proUid
|
* @param string $proUid
|
||||||
|
* @param boolean $unsetDynId
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
*
|
||||||
|
* @see Processes::getWorkflowData()
|
||||||
|
* @see ProcessMaker\BusinessModel\Migrator\DynaformsMigrator::export()
|
||||||
|
* @see ProcessMaker\Importer\Importer::saveCurrentProcess()
|
||||||
*/
|
*/
|
||||||
public function getDynaformRows($proUid)
|
public function getDynaformRows($proUid, $unsetDynId = true)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$dynaformList = [];
|
$dynaformList = [];
|
||||||
@@ -2947,7 +2982,9 @@ class Processes
|
|||||||
while ($row = $dataset->getRow()) {
|
while ($row = $dataset->getRow()) {
|
||||||
$dynaform = new Dynaform();
|
$dynaform = new Dynaform();
|
||||||
$infoDyn = $dynaform->Load($row['DYN_UID']);
|
$infoDyn = $dynaform->Load($row['DYN_UID']);
|
||||||
unset($infoDyn['DYN_ID']);
|
if ($unsetDynId === true) {
|
||||||
|
unset($infoDyn['DYN_ID']);
|
||||||
|
}
|
||||||
$dynaformList[] = $infoDyn;
|
$dynaformList[] = $infoDyn;
|
||||||
$dataset->next();
|
$dataset->next();
|
||||||
}
|
}
|
||||||
@@ -3077,12 +3114,16 @@ class Processes
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create dynaforms for a process
|
* Create dynaforms for a process.
|
||||||
*
|
*
|
||||||
* @param array $dynaforms
|
* @param array $dynaforms
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
*
|
||||||
|
* @see Processes::createProcessPropertiesFromData()
|
||||||
|
* @see Processes::updateProcessFromData()
|
||||||
|
* @see ProcessMaker\BusinessModel\Migrator\DynaformsMigrator::import()
|
||||||
*/
|
*/
|
||||||
public function createDynaformRows($dynaforms)
|
public function createDynaformRows($dynaforms)
|
||||||
{
|
{
|
||||||
@@ -3097,11 +3138,15 @@ class Processes
|
|||||||
//Get the DYN_ID column
|
//Get the DYN_ID column
|
||||||
$dataSet = BasePeer::doSelect($criteria, $con);
|
$dataSet = BasePeer::doSelect($criteria, $con);
|
||||||
$dataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
$dataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
if ($dataSet->next()) {
|
if (isset($row["__DYN_ID_UPDATE__"]) && $row["__DYN_ID_UPDATE__"] === false) {
|
||||||
$dynInfo = $dataSet->getRow();
|
unset($row["__DYN_ID_UPDATE__"]);
|
||||||
$row['DYN_ID'] = $dynInfo['DYN_ID'];
|
|
||||||
} else {
|
} else {
|
||||||
$row['DYN_ID'] = null;
|
if ($dataSet->next()) {
|
||||||
|
$dynInfo = $dataSet->getRow();
|
||||||
|
$row['DYN_ID'] = $dynInfo['DYN_ID'];
|
||||||
|
} else {
|
||||||
|
$row['DYN_ID'] = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
BasePeer::doDelete($criteria, $con);
|
BasePeer::doDelete($criteria, $con);
|
||||||
//Prepare the insert
|
//Prepare the insert
|
||||||
|
|||||||
@@ -91,6 +91,16 @@ class SpoolRun
|
|||||||
$this->appMsgUid = $v;
|
$this->appMsgUid = $v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the fileData property
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getFileData()
|
||||||
|
{
|
||||||
|
return $this->fileData;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get all files into spool in a list
|
* get all files into spool in a list
|
||||||
*
|
*
|
||||||
@@ -212,32 +222,52 @@ class SpoolRun
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set email parameters
|
* Set email parameters
|
||||||
*
|
*
|
||||||
* @param string $sAppMsgUid , $sSubject, $sFrom, $sTo, $sBody, $sDate, $sCC, $sBCC, $sTemplate
|
* @param string $appMsgUid
|
||||||
* @return none
|
* @param string $subject
|
||||||
|
* @param string $from
|
||||||
|
* @param string $to
|
||||||
|
* @param string $body
|
||||||
|
* @param string $date
|
||||||
|
* @param string $cc
|
||||||
|
* @param string $bcc
|
||||||
|
* @param string $template
|
||||||
|
* @param array $attachments
|
||||||
|
* @param bool $contentTypeIsHtml
|
||||||
|
* @param string $error
|
||||||
|
*
|
||||||
|
* @see SpoolRun->create()
|
||||||
|
* @see SpoolRun->resendEmails()
|
||||||
*/
|
*/
|
||||||
public function setData($sAppMsgUid, $sSubject, $sFrom, $sTo, $sBody, $sDate = "", $sCC = "", $sBCC = "", $sTemplate = "", $aAttachment = array(), $bContentTypeIsHtml = true, $sError = "")
|
public function setData($appMsgUid, $subject, $from, $to, $body, $date = '', $cc = '', $bcc = '', $template = '', $attachments = [],
|
||||||
|
$contentTypeIsHtml = true, $error = '')
|
||||||
{
|
{
|
||||||
$this->spoolId = $sAppMsgUid;
|
// Fill "fileData" property
|
||||||
$this->fileData['subject'] = $sSubject;
|
$this->spoolId = $appMsgUid;
|
||||||
$this->fileData['from'] = $sFrom;
|
$this->fileData['subject'] = $subject;
|
||||||
$this->fileData['to'] = $sTo;
|
$this->fileData['from'] = $from;
|
||||||
$this->fileData['body'] = $sBody;
|
$this->fileData['to'] = $to;
|
||||||
$this->fileData['date'] = ($sDate != '' ? $sDate : date('Y-m-d H:i:s'));
|
$this->fileData['body'] = $body;
|
||||||
$this->fileData['cc'] = $sCC;
|
$this->fileData['date'] = (!empty($date) ? $date : date('Y-m-d H:i:s'));
|
||||||
$this->fileData['bcc'] = $sBCC;
|
$this->fileData['cc'] = $cc;
|
||||||
$this->fileData['template'] = $sTemplate;
|
$this->fileData['bcc'] = $bcc;
|
||||||
$this->fileData['attachments'] = $aAttachment;
|
$this->fileData['template'] = $template;
|
||||||
$this->fileData['envelope_to'] = array();
|
$this->fileData['attachments'] = $attachments;
|
||||||
$this->fileData["contentTypeIsHtml"] = $bContentTypeIsHtml;
|
$this->fileData["contentTypeIsHtml"] = $contentTypeIsHtml;
|
||||||
$this->fileData["error"] = $sError;
|
$this->fileData["error"] = $error;
|
||||||
|
|
||||||
|
// Initialize some values used internally
|
||||||
|
$this->fileData['envelope_to'] = [];
|
||||||
|
$this->fileData['envelope_cc'] = [];
|
||||||
|
$this->fileData['envelope_bcc'] = [];
|
||||||
|
|
||||||
|
// Domain validation when the email engine is "OpenMail"
|
||||||
if (array_key_exists('MESS_ENGINE', $this->config)) {
|
if (array_key_exists('MESS_ENGINE', $this->config)) {
|
||||||
if ($this->config['MESS_ENGINE'] == 'OPENMAIL') {
|
if ($this->config['MESS_ENGINE'] === 'OPENMAIL') {
|
||||||
if ($this->config['MESS_SERVER'] != '') {
|
if (!empty($this->config['MESS_SERVER'])) {
|
||||||
if (($sAux = @gethostbyaddr($this->config['MESS_SERVER']))) {
|
if (($domain = @gethostbyaddr($this->config['MESS_SERVER']))) {
|
||||||
$this->fileData['domain'] = $sAux;
|
$this->fileData['domain'] = $domain;
|
||||||
} else {
|
} else {
|
||||||
$this->fileData['domain'] = $this->config['MESS_SERVER'];
|
$this->fileData['domain'] = $this->config['MESS_SERVER'];
|
||||||
}
|
}
|
||||||
@@ -818,4 +848,12 @@ class SpoolRun
|
|||||||
|
|
||||||
return $appMsgUid;
|
return $appMsgUid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run the private method "handleEnvelopeTo", this method was created in order to use in the unit tests
|
||||||
|
*/
|
||||||
|
public function runHandleEnvelopeTo()
|
||||||
|
{
|
||||||
|
$this->handleEnvelopeTo();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23660,8 +23660,8 @@ msgstr "Setting SUPER privilege"
|
|||||||
# TRANSLATION
|
# TRANSLATION
|
||||||
# LABEL/ID_SETUP
|
# LABEL/ID_SETUP
|
||||||
#: LABEL/ID_SETUP
|
#: LABEL/ID_SETUP
|
||||||
msgid "ADMIN"
|
msgid "Admin"
|
||||||
msgstr "ADMIN"
|
msgstr "Admin"
|
||||||
|
|
||||||
# TRANSLATION
|
# TRANSLATION
|
||||||
# LABEL/ID_SETUP_MAILCONF_TITLE
|
# LABEL/ID_SETUP_MAILCONF_TITLE
|
||||||
|
|||||||
@@ -60832,7 +60832,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
|
|||||||
( 'LABEL','ID_SETTINGS_HEARTBEAT_TITLE','en','Display Setting','2014-01-15') ,
|
( 'LABEL','ID_SETTINGS_HEARTBEAT_TITLE','en','Display Setting','2014-01-15') ,
|
||||||
( 'LABEL','ID_SETTING_MESSAGE','en','The Settings tool was clicked','2014-01-15') ,
|
( 'LABEL','ID_SETTING_MESSAGE','en','The Settings tool was clicked','2014-01-15') ,
|
||||||
( 'LABEL','ID_SETTING_SUPER','en','Setting SUPER privilege','2014-01-28') ,
|
( 'LABEL','ID_SETTING_SUPER','en','Setting SUPER privilege','2014-01-28') ,
|
||||||
( 'LABEL','ID_SETUP','en','ADMIN','2014-01-15') ,
|
( 'LABEL','ID_SETUP','en','Admin','2014-01-15') ,
|
||||||
( 'LABEL','ID_SETUP_MAILCONF_TITLE','en','Test SMTP Connection','2014-01-15') ,
|
( 'LABEL','ID_SETUP_MAILCONF_TITLE','en','Test SMTP Connection','2014-01-15') ,
|
||||||
( 'LABEL','ID_SETUP_WEBSERVICES','en','Setup','2014-01-15') ,
|
( 'LABEL','ID_SETUP_WEBSERVICES','en','Setup','2014-01-15') ,
|
||||||
( 'LABEL','ID_SET_A_TABLE_NAME','en','Set a Table Name','2014-01-15') ,
|
( 'LABEL','ID_SET_A_TABLE_NAME','en','Set a Table Name','2014-01-15') ,
|
||||||
|
|||||||
@@ -2,32 +2,9 @@
|
|||||||
/**
|
/**
|
||||||
* processmaker.php
|
* processmaker.php
|
||||||
*
|
*
|
||||||
* ProcessMaker Open Source Edition
|
* ProcessMaker main menu
|
||||||
* Copyright (C) 2004 - 2008 Colosa Inc.23
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
|
||||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*************************************
|
|
||||||
* ---= Processmaker main menu=---
|
|
||||||
*************************************/
|
|
||||||
|
|
||||||
global $G_TMP_MENU;
|
global $G_TMP_MENU;
|
||||||
global $RBAC;
|
global $RBAC;
|
||||||
|
|
||||||
@@ -57,7 +34,7 @@ if ($RBAC->userCanAccess('PM_DASHBOARD') == 1) {
|
|||||||
|
|
||||||
// ADMIN MODULE
|
// ADMIN MODULE
|
||||||
if ($RBAC->userCanAccess('PM_SETUP') == 1 || $RBAC->userCanAccess('PM_USERS') == 1) {
|
if ($RBAC->userCanAccess('PM_SETUP') == 1 || $RBAC->userCanAccess('PM_USERS') == 1) {
|
||||||
$G_TMP_MENU->AddIdRawOption('SETUP', 'setup/main', strtolower(G::LoadTranslation('ID_SETUP')), '', '', '', 'x-pm-setup');
|
$G_TMP_MENU->AddIdRawOption('SETUP', 'setup/main', G::LoadTranslation('ID_SETUP'), '', '', '', 'x-pm-setup');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -300,6 +300,24 @@ abstract class Importer
|
|||||||
$this->preserveEmailEventConfiguration($emailEvent);
|
$this->preserveEmailEventConfiguration($emailEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($this->importData["tables"]["workflow"]["dynaforms"])) {
|
||||||
|
foreach ($this->importData["tables"]["workflow"]["dynaforms"] as &$dynaform) {
|
||||||
|
$this->preserveDynaformId($dynaform);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($this->importData["tables"]["workflow"]["inputs"])) {
|
||||||
|
foreach ($this->importData["tables"]["workflow"]["inputs"] as &$input) {
|
||||||
|
$this->preserveInputDocumentId($input);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($this->importData["tables"]["workflow"]["outputs"])) {
|
||||||
|
foreach ($this->importData["tables"]["workflow"]["outputs"] as &$output) {
|
||||||
|
$this->preserveOutputDocumentId($output);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$objectList = $granularObj->loadObjectsListSelected($this->importData, $newObjectArray);
|
$objectList = $granularObj->loadObjectsListSelected($this->importData, $newObjectArray);
|
||||||
if (sizeof($objectList) > 0 && $processGranulate) {
|
if (sizeof($objectList) > 0 && $processGranulate) {
|
||||||
@@ -602,6 +620,18 @@ abstract class Importer
|
|||||||
foreach ($arrayWorkflowTables["emailEvent"] as &$emailEvent) {
|
foreach ($arrayWorkflowTables["emailEvent"] as &$emailEvent) {
|
||||||
$this->preserveEmailEventConfiguration($emailEvent);
|
$this->preserveEmailEventConfiguration($emailEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ($arrayWorkflowTables["dynaforms"] as &$dynaform) {
|
||||||
|
$this->preserveDynaformId($dynaform);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($arrayWorkflowTables["inputs"] as &$input) {
|
||||||
|
$this->preserveInputDocumentId($input);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($arrayWorkflowTables["outputs"] as &$output) {
|
||||||
|
$this->preserveOutputDocumentId($output);
|
||||||
|
}
|
||||||
|
|
||||||
$this->importWfTables($arrayWorkflowTables);
|
$this->importWfTables($arrayWorkflowTables);
|
||||||
|
|
||||||
@@ -862,6 +892,8 @@ abstract class Importer
|
|||||||
* Saves the current objects before import.
|
* Saves the current objects before import.
|
||||||
*
|
*
|
||||||
* @param string $proUid
|
* @param string $proUid
|
||||||
|
*
|
||||||
|
* @see ProcessMaker\Importer\Importer::import()
|
||||||
*/
|
*/
|
||||||
public function saveCurrentProcess($proUid)
|
public function saveCurrentProcess($proUid)
|
||||||
{
|
{
|
||||||
@@ -873,9 +905,9 @@ abstract class Importer
|
|||||||
$result->tasks = $processes->getTaskRows($proUid);
|
$result->tasks = $processes->getTaskRows($proUid);
|
||||||
$result->abeConfigurations = $processes->getActionsByEmail($proUid);
|
$result->abeConfigurations = $processes->getActionsByEmail($proUid);
|
||||||
$result->emailEvents = $processes->getEmailEvent($proUid);
|
$result->emailEvents = $processes->getEmailEvent($proUid);
|
||||||
$result->dynaforms = $processes->getDynaformRows($proUid);
|
$result->dynaforms = $processes->getDynaformRows($proUid, false);
|
||||||
$result->inputs = $processes->getInputRows($proUid);
|
$result->inputs = $processes->getInputRows($proUid, false);
|
||||||
$result->outputs = $processes->getOutputRows($proUid);
|
$result->outputs = $processes->getOutputRows($proUid, false);
|
||||||
|
|
||||||
$this->setCurrentProcess($result);
|
$this->setCurrentProcess($result);
|
||||||
}
|
}
|
||||||
@@ -948,4 +980,87 @@ abstract class Importer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restore DYN_ID value for specific dynaform.
|
||||||
|
* The value of __DYN_ID_UPDATE__ only used like a reference.
|
||||||
|
*
|
||||||
|
* @param array $data
|
||||||
|
*
|
||||||
|
* @see ProcessMaker\Importer\Importer::import()
|
||||||
|
* @see ProcessMaker\Importer\Importer::doImport()
|
||||||
|
* @link https://wiki.processmaker.com/3.1/Importing_and_Exporting_Projects#Importing_a_Project
|
||||||
|
*/
|
||||||
|
public function preserveDynaformId(&$data)
|
||||||
|
{
|
||||||
|
$currentProccess = $this->getCurrentProcess();
|
||||||
|
if (!is_object($currentProccess)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!is_array($currentProccess->dynaforms)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
foreach ($currentProccess->dynaforms as $dynaform) {
|
||||||
|
if ($data["DYN_UID"] === $dynaform["DYN_UID"]) {
|
||||||
|
$data["DYN_ID"] = $dynaform["DYN_ID"];
|
||||||
|
$data["__DYN_ID_UPDATE__"] = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restore INP_DOC_ID value for specific input document.
|
||||||
|
* The value of __INP_DOC_ID_UPDATE__ only used like a reference.
|
||||||
|
*
|
||||||
|
* @param array $data
|
||||||
|
*
|
||||||
|
* @see ProcessMaker\Importer\Importer::import()
|
||||||
|
* @see ProcessMaker\Importer\Importer::doImport()
|
||||||
|
* @link https://wiki.processmaker.com/3.1/Importing_and_Exporting_Projects#Importing_a_Project
|
||||||
|
*/
|
||||||
|
public function preserveInputDocumentId(&$data)
|
||||||
|
{
|
||||||
|
$currentProccess = $this->getCurrentProcess();
|
||||||
|
if (!is_object($currentProccess)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!is_array($currentProccess->inputs)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
foreach ($currentProccess->inputs as $inputDocument) {
|
||||||
|
if ($data["INP_DOC_UID"] === $inputDocument["INP_DOC_UID"]) {
|
||||||
|
$data["INP_DOC_ID"] = $inputDocument["INP_DOC_ID"];
|
||||||
|
$data["__INP_DOC_ID_UPDATE__"] = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restore OUT_DOC_ID value for specific output document.
|
||||||
|
* The value of __OUT_DOC_ID_UPDATE__ only used like a reference.
|
||||||
|
*
|
||||||
|
* @param array $data
|
||||||
|
*
|
||||||
|
* @see ProcessMaker\Importer\Importer::import()
|
||||||
|
* @see ProcessMaker\Importer\Importer::doImport()
|
||||||
|
* @link https://wiki.processmaker.com/3.1/Importing_and_Exporting_Projects#Importing_a_Project
|
||||||
|
*/
|
||||||
|
public function preserveOutputDocumentId(&$data)
|
||||||
|
{
|
||||||
|
$currentProccess = $this->getCurrentProcess();
|
||||||
|
if (!is_object($currentProccess)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!is_array($currentProccess->outputs)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
foreach ($currentProccess->outputs as $outputDocument) {
|
||||||
|
if ($data["OUT_DOC_UID"] === $outputDocument["OUT_DOC_UID"]) {
|
||||||
|
$data["OUT_DOC_ID"] = $outputDocument["OUT_DOC_ID"];
|
||||||
|
$data["__OUT_DOC_ID_UPDATE__"] = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,8 +14,13 @@ use Illuminate\Support\Facades\DB;
|
|||||||
class Dynaform extends Model
|
class Dynaform extends Model
|
||||||
{
|
{
|
||||||
protected $table = 'DYNAFORM';
|
protected $table = 'DYNAFORM';
|
||||||
|
protected $primaryKey = "DYN_ID";
|
||||||
public $timestamps = false;
|
public $timestamps = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return relation process.
|
||||||
|
* @return object
|
||||||
|
*/
|
||||||
public function process()
|
public function process()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(Process::class, 'PRO_UID', 'PRO_UID');
|
return $this->belongsTo(Process::class, 'PRO_UID', 'PRO_UID');
|
||||||
|
|||||||
45
workflow/engine/src/ProcessMaker/Model/InputDocument.php
Normal file
45
workflow/engine/src/ProcessMaker/Model/InputDocument.php
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace ProcessMaker\Model;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a input document object in the system.
|
||||||
|
*/
|
||||||
|
class InputDocument extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'INPUT_DOCUMENT';
|
||||||
|
protected $primaryKey = 'INP_DOC_ID';
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return relation process.
|
||||||
|
* @return object
|
||||||
|
*/
|
||||||
|
public function process()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Process::class, 'PRO_UID', 'PRO_UID');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get input documents by PRO_UID
|
||||||
|
* @param string $proUid
|
||||||
|
* @return \Illuminate\Database\Eloquent\Collection
|
||||||
|
*/
|
||||||
|
public static function getByProUid($proUid)
|
||||||
|
{
|
||||||
|
return InputDocument::where('PRO_UID', '=', $proUid)->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get input document by INP_DOC_UID
|
||||||
|
* @param type $inpDocUid
|
||||||
|
* @return Model
|
||||||
|
*/
|
||||||
|
public static function getByInpDocUid($inpDocUid)
|
||||||
|
{
|
||||||
|
return InputDocument::where('INP_DOC_UID', '=', $inpDocUid)->first();
|
||||||
|
}
|
||||||
|
}
|
||||||
45
workflow/engine/src/ProcessMaker/Model/OutputDocument.php
Normal file
45
workflow/engine/src/ProcessMaker/Model/OutputDocument.php
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace ProcessMaker\Model;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a output document object in the system.
|
||||||
|
*/
|
||||||
|
class OutputDocument extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'OUTPUT_DOCUMENT';
|
||||||
|
protected $primaryKey = 'OUT_DOC_ID';
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return relation process.
|
||||||
|
* @return object
|
||||||
|
*/
|
||||||
|
public function process()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Process::class, 'PRO_UID', 'PRO_UID');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get output documents by PRO_UID.
|
||||||
|
* @param string $proUid
|
||||||
|
* @return \Illuminate\Database\Eloquent\Collection
|
||||||
|
*/
|
||||||
|
public static function getByProUid($proUid)
|
||||||
|
{
|
||||||
|
return OutputDocument::where('PRO_UID', '=', $proUid)->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get output document by OUT_DOC_UID.
|
||||||
|
* @param string $outDocUid
|
||||||
|
* @return Model
|
||||||
|
*/
|
||||||
|
public static function getByOutDocUid($outDocUid)
|
||||||
|
{
|
||||||
|
return OutputDocument::where('OUT_DOC_UID', '=', $outDocUid)->first();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user