Complete tests, and check validations for WebEntry CRUD.
This commit is contained in:
davidcallizaya
2017-05-22 11:26:15 -04:00
parent bfc0be7e44
commit 2b918b25fc
12 changed files with 227 additions and 45 deletions

View File

@@ -77,4 +77,30 @@ class WorkflowTestCase extends TestCase
exec('../../gulliver/bin/gulliver propel-build-model');
chdir($pwd);
}
/**
* Set the text of and specific translated message.
*
* @global array $translation
* @param type $msgId
* @param type $text
*/
protected function setTranslation($msgId, $text)
{
global $translation;
$translation[$msgId] = $text;
}
/**
* Clear all the translated messages loaded.
*
* @global array $translation
*/
protected function clearTranslations()
{
global $translation;
foreach ($translation as $msgId => $text) {
unset($translation[$msgId]);
}
}
}

View File

@@ -2,7 +2,7 @@
// ProcessMaker Test Unit Bootstrap
// Defining the PATH_SEP constant, he we are defining if the the path separator symbol will be '\\' or '/'
error_reporting(E_ALL ^ E_STRICT);
error_reporting(E_ALL ^ E_STRICT ^ E_DEPRECATED);
define('PATH_SEP', '/');
if (!defined('__DIR__')) {
@@ -232,3 +232,8 @@ define('TIME_ZONE', $config ['time_zone']);
require_once 'WorkflowTestCase.php';
require_once(PATH_CLASSES.'model/Task.php');
global $RBAC;
$RBAC = \RBAC::getSingleton( PATH_DATA, session_id() );
$RBAC->sSystem = 'PROCESSMAKER';
\G::LoadClass('pmFunctions');

View File

@@ -7,8 +7,10 @@ namespace ProcessMaker\BusinessModel;
*/
class WebEntryEventTest extends \WorkflowTestCase
{
const SKIP_VALUE = '&SKIP_VALUE%';
/**
* @var WebEntryEvent
* @var WebEntryEvent $object
*/
protected $object;
private $processUid;
@@ -18,8 +20,7 @@ class WebEntryEventTest extends \WorkflowTestCase
private $domain = 'http://domain.localhost';
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
* Sets up the unit test.
*/
protected function setUp()
{
@@ -27,6 +28,10 @@ class WebEntryEventTest extends \WorkflowTestCase
$this->processUid = $this->import(__DIR__.'/WebEntryEventTest.pmx');
$this->processUid2 = $this->import(__DIR__.'/WebEntryEventTest2.pmx');
$this->object = new WebEntryEvent;
$this->setTranslation('ID_INVALID_VALUE_CAN_NOT_BE_EMPTY',
'ID_INVALID_VALUE_CAN_NOT_BE_EMPTY({0})');
$this->setTranslation('ID_UNDEFINED_VALUE_IS_REQUIRED',
'ID_UNDEFINED_VALUE_IS_REQUIRED({0})');
}
/**
@@ -36,10 +41,12 @@ class WebEntryEventTest extends \WorkflowTestCase
protected function tearDown()
{
//$this->dropDB();
$this->clearTranslations();
}
/**
* @covers ProcessMaker\BusinessModel\WebEntryEvent::getWebEntryEvents
* @category HOR-3207:5
*/
public function testGetWebEntryEvents()
{
@@ -65,7 +72,6 @@ class WebEntryEventTest extends \WorkflowTestCase
$entryEvents = $this->object->getAllWebEntryEvents();
$this->assertCount(3, $entryEvents);
$this->assertNull($entryEvents[0]['WE_CUSTOM_TITLE']);
//$this->assertNull($entryEvents[0]['WE_MULTIPLE_UID']);
$this->assertEquals($entryEvents[0]['WE_AUTHENTICATION'], 'ANONYMOUS');
$this->assertEquals($entryEvents[0]['WE_HIDE_INFORMATION_BAR'], '0');
$this->assertEquals($entryEvents[0]['WE_CALLBACK'], 'PROCESS_MAKER');
@@ -78,6 +84,7 @@ class WebEntryEventTest extends \WorkflowTestCase
/**
* @covers ProcessMaker\BusinessModel\WebEntryEvent::getWebEntryEvent
* @category HOR-3207:6
*/
public function testGetWebEntryEvent()
{
@@ -86,6 +93,11 @@ class WebEntryEventTest extends \WorkflowTestCase
$this->assertEquals($entryEvents[0], $entry);
}
/**
* Duplicated web entry
* @cover ProcessMaker\BusinessModel\WebEntryEvent::create
* @category HOR-3207:7,HOR-3207:2
*/
public function testCreateSingleNonAuthAlreadyRegistered()
{
$this->expectException(\Exception::class);
@@ -100,6 +112,7 @@ class WebEntryEventTest extends \WorkflowTestCase
'DYN_UID' => $dynaform->getDynUid(),
'WEE_STATUS' => 'ENABLED',
'USR_UID' => $this->adminUid,
'WEE_TITLE' => $entryEvents[0]['EVN_UID'],
]
);
$this->assertEquals(
@@ -111,6 +124,7 @@ class WebEntryEventTest extends \WorkflowTestCase
/**
* Create a new empty single non auth WE
* @cover ProcessMaker\BusinessModel\WebEntryEvent::create
* @category HOR-3207:7
*/
public function testCreateSingleNonAuth()
{
@@ -131,6 +145,7 @@ class WebEntryEventTest extends \WorkflowTestCase
/**
* Create a new empty multiple non auth WE
* @cover ProcessMaker\BusinessModel\WebEntryEvent::create
* @category HOR-3207:7
*/
public function testCreateNewMultipleNonAuth()
{
@@ -140,7 +155,7 @@ class WebEntryEventTest extends \WorkflowTestCase
$processUid, $entryEvents,
[
'WEE_URL' => $this->domain."/sys".SYS_SYS."/".SYS_LANG."/".SYS_SKIN."/".$processUid."/custom.php",
'WE_TYPE' => "SINGLE",
'WE_TYPE' => "MULTIPLE",
'WE_CUSTOM_TITLE' => $this->customTitle,
'WE_AUTHENTICATION' => 'ANONYMOUS',
'WE_HIDE_INFORMATION_BAR' => "0",
@@ -157,6 +172,7 @@ class WebEntryEventTest extends \WorkflowTestCase
/**
* Delete a webentry
* @cover ProcessMaker\BusinessModel\WebEntryEvent::delete
* @category HOR-3207:9
*/
public function testDelete()
{
@@ -164,6 +180,7 @@ class WebEntryEventTest extends \WorkflowTestCase
$criteria = new \Criteria;
$criteria->add(\WebEntryPeer::PRO_UID, $processUid);
$entryEvents = $this->object->getWebEntryEvents($processUid);
$fistWebEntryUid = $entryEvents[0]['WEE_UID'];
$this->assertCount(2, $entryEvents);
$this->assertCount(2, \WebEntryPeer::doSelect($criteria));
$this->object->delete($entryEvents[0]['WEE_UID']);
@@ -174,11 +191,14 @@ class WebEntryEventTest extends \WorkflowTestCase
$entryEvents = $this->object->getWebEntryEvents($processUid);
$this->assertCount(0, $entryEvents);
$this->assertCount(0, \WebEntryPeer::doSelect($criteria));
$this->expectException(\Exception::class);
$this->object->delete($fistWebEntryUid);
}
/**
* Create different combinations of WE
* @cover ProcessMaker\BusinessModel\WebEntryEvent::create
* @category HOR-3207:7
*/
public function testCreate()
{
@@ -192,10 +212,8 @@ class WebEntryEventTest extends \WorkflowTestCase
$this->domain."/sys".SYS_SYS."/".SYS_LANG."/".SYS_SKIN."/".$processUid."/custom.php",
null
],
//'WE_TYPE' => ['SINGLE', 'MULTIPLE'],
//'WE_AUTHENTICATION' => ['ANONYMOUS', 'LOGIN_REQUIRED'],
//'WE_HIDE_INFORMATION_BAR'=>['0', '1'],
//'WE_CALLBACK'=>['PROCESS_MAKER', 'CUSTOM', 'CUSTOM_CLEAR'],
'WEE_STATUS' => ['ENABLED', null],
'WE_TYPE' => ['MULTIPLE'],
'WE_LINK_SKIN' => [SYS_SKIN, null],
'WE_LINK_LANGUAGE' => [SYS_LANG, null],
]);
@@ -206,14 +224,15 @@ class WebEntryEventTest extends \WorkflowTestCase
foreach ($rows as $row) {
try {
$data = [
'EVN_UID' => $event->getEvnUid(),
'ACT_UID' => $entryEvents[0]['ACT_UID'],
'WEE_STATUS' => 'ENABLED',
'USR_UID' => $this->adminUid,
'WEE_TITLE' => $event->getEvnUid(),
'EVN_UID' => $event->getEvnUid(),
'ACT_UID' => $entryEvents[0]['ACT_UID'],
'USR_UID' => $this->adminUid,
'WEE_TITLE' => $event->getEvnUid(),
];
foreach ($row as $key => $value) {
if (isset($value)) $data[$key] = $value;
if (isset($value)) {
$data[$key] = $value;
}
}
$this->object->create($processUid, $this->adminUid, $data);
$entryEvents2 = $this->object->getWebEntryEvents($processUid);
@@ -249,6 +268,7 @@ class WebEntryEventTest extends \WorkflowTestCase
/**
* Create a WE with invalid parameters
* @cover ProcessMaker\BusinessModel\WebEntryEvent::create
* @category HOR-3207:7,HOR-3207:2
*/
public function testInvalidCreate()
{
@@ -278,6 +298,7 @@ class WebEntryEventTest extends \WorkflowTestCase
* Update different combinations of web entries
* @throws \PHPUnit_Framework_ExpectationFailedException
* @cover ProcessMaker\BusinessModel\WebEntryEvent::update
* @category HOR-3207:8
*/
public function testUpdate()
{
@@ -302,13 +323,7 @@ class WebEntryEventTest extends \WorkflowTestCase
null
],
'DYN_UID' => $dynaformIds,
//WEE_STATUS DELETE THE WEB_ENTRY (NOT USED FROM UI)
//'WEE_STATUS' => ['ENABLED', 'DISABLED'],
//'WE_AUTHENTICATION' => ['ANONYMOUS', 'LOGIN_REQUIRED'],
//'WE_HIDE_INFORMATION_BAR'=>['0', '1'],
//'WE_CALLBACK'=>['PROCESS_MAKER', 'CUSTOM', 'CUSTOM_CLEAR'],
'WE_LINK_SKIN' => [SYS_SKIN, null],
'WE_LINK_LANGUAGE' => [SYS_LANG, null],
'USR_UID' => [null, $this->adminUid, static::SKIP_VALUE],
]);
foreach ($rows as $row) {
try {
@@ -338,6 +353,7 @@ class WebEntryEventTest extends \WorkflowTestCase
/**
* Update WE with invalid parameters
* @cover ProcessMaker\BusinessModel\WebEntryEvent::update
* @category HOR-3207:8,HOR-3207:2
*/
public function testInvalidUpdate()
{
@@ -346,11 +362,11 @@ class WebEntryEventTest extends \WorkflowTestCase
$entryEvent = $entryEvents[0];
$webEntryEventUid = $entryEvent['WEE_UID'];
$userUidUpdater = $this->adminUid;
$this->expectException(\Exception::class);
$this->expectExceptionMessageRegExp('/(Please enter a valid value for (WE_TYPE|WE_AUTHENTICATION|WE_CALLBACK|WE_LINK_GENERATION)\s*){4,4}/');
$this->object->update($webEntryEventUid, $userUidUpdater,
[
[
'WEE_URL' => $this->domain."/sys".SYS_SYS."/".SYS_LANG."/".SYS_SKIN."/".$processUid."/custom.php",
'WE_TYPE' => "NOT-VALID-SINGLE",
'WE_CUSTOM_TITLE' => $this->customTitle,
@@ -366,21 +382,120 @@ class WebEntryEventTest extends \WorkflowTestCase
);
}
//Auxiliar methods
/**
* Required USR_UID
* @cover ProcessMaker\BusinessModel\WebEntryEvent::update
* @category HOR-3207:2
*/
public function testUsrUidNotRequiredIfLoginRequired()
{
$processUid = $this->processUid2;
$entryEvents = $this->object->getWebEntryEvents($processUid);
list($webEntry, $entryEvent) = $this->createWebEntryEvent(
$processUid, $entryEvents,
[
'WE_AUTHENTICATION' => 'LOGIN_REQUIRED',
'DYN_UID' => $entryEvents[0]['DYN_UID'],
'USR_UID' => null,
]
);
}
/**
* Required fields
* @cover ProcessMaker\BusinessModel\WebEntryEvent::create
* @category HOR-3207:2
*/
public function testRequiredFields()
{
$processUid = $this->processUid2;
$entryEvents = $this->object->getWebEntryEvents($processUid);
$dynaform = $this->getADynaform($processUid);
$criteria = new \Criteria();
$criteria->add(\BpmnEventPeer::PRJ_UID, $processUid);
$criteria->add(\BpmnEventPeer::EVN_NAME, 'simple start');
$event = \BpmnEventPeer::doSelectOne($criteria);
//EVN_UID
try {
$data = [
];
$this->object->create($processUid, $this->adminUid, $data);
} catch (\Exception $e) {
$this->assertEquals('ID_INVALID_VALUE_CAN_NOT_BE_EMPTY($arrayData)',
$e->getMessage());
}
//EVN_UID
try {
$data = [
'WE_CUSTOM_TITLE' => $this->customTitle,
];
$this->object->create($processUid, $this->adminUid, $data);
} catch (\Exception $e) {
$this->assertEquals('ID_UNDEFINED_VALUE_IS_REQUIRED(EVN_UID)',
$e->getMessage());
}
//ACT_UID
try {
$data = [
'EVN_UID' => $event->getEvnUid(),
];
$this->object->create($processUid, $this->adminUid, $data);
} catch (\Exception $e) {
$this->assertEquals('ID_UNDEFINED_VALUE_IS_REQUIRED(ACT_UID)',
$e->getMessage());
}
//DYN_UID
try {
$data = [
'EVN_UID' => $event->getEvnUid(),
'ACT_UID' => $entryEvents[0]['ACT_UID'],
];
$this->object->create($processUid, $this->adminUid, $data);
} catch (\Exception $e) {
$this->assertEquals('ID_UNDEFINED_VALUE_IS_REQUIRED(DYN_UID)',
$e->getMessage());
}
//USR_UID (WE_AUTHENTICATION=ANONYMOUS)
try {
$data = [
'EVN_UID' => $event->getEvnUid(),
'ACT_UID' => $entryEvents[0]['ACT_UID'],
'DYN_UID' => $dynaform->getDynUid(),
];
$this->object->create($processUid, $this->adminUid, $data);
} catch (\Exception $e) {
$this->assertEquals('ID_UNDEFINED_VALUE_IS_REQUIRED(USR_UID)',
$e->getMessage());
}
//WEE_TITLE
try {
$data = [
'EVN_UID' => $event->getEvnUid(),
'ACT_UID' => $entryEvents[0]['ACT_UID'],
'DYN_UID' => $dynaform->getDynUid(),
'USR_UID' => $this->adminUid,
];
$this->object->create($processUid, $this->adminUid, $data);
} catch (\Exception $e) {
$this->assertEquals('ID_INVALID_VALUE_CAN_NOT_BE_EMPTY(WEE_TITLE)',
$e->getMessage());
}
}
/**
* get a dynaform
* @return type
*/
private function getADynaform()
private function getADynaform($processUid = null)
{
$criteria = new \Criteria;
$criteria->add(\DynaformPeer::PRO_UID, $this->processUid);
$criteria->add(\DynaformPeer::PRO_UID,
$processUid ? $processUid : $this->processUid);
return \DynaformPeer::doSelectOne($criteria);
}
/**
*
* Get a WebEntry from a WebEntryEvent array
* @param type $webEntryEvent
* @return \WebEntry
*/
@@ -390,6 +505,12 @@ class WebEntryEventTest extends \WorkflowTestCase
return \WebEntryPeer::retrieveByPK($wee->getWeeWeUid());
}
/**
* The default generated WebEntryUrl.
*
* @param \WebEntry $we
* @return type
*/
private function getSimpleWebEntryUrl(\WebEntry $we)
{
return (\G::is_https() ? "https://" : "http://").
@@ -397,6 +518,14 @@ class WebEntryEventTest extends \WorkflowTestCase
SYS_LANG."/".SYS_SKIN."/".$we->getProUid()."/".$we->getWeData();
}
/**
* Create a WebEntryEvent using some default properties.
*
* @param type $processUid
* @param type $entryEvents
* @param type $config
* @return type
*/
private function createWebEntryEvent($processUid, $entryEvents, $config)
{
$this->assertCount(1, $entryEvents,
@@ -447,7 +576,10 @@ class WebEntryEventTest extends \WorkflowTestCase
$ii = $i;
foreach ($combinations as $key => $values) {
$c = count($values);
$row[$key] = $values[$ii % $c];
$value = $values[$ii % $c];
if (static::SKIP_VALUE !== $value) {
$row[$key] = $value;
}
$ii = floor($ii / $c);
}
$rows[] = $row;

View File

@@ -1307,7 +1307,7 @@ class wsBase
return $result;
} catch (Exception $e) {
$result = wsCreateUserResponse( 100, $e->getMessage(), null );
$result = new wsCreateUserResponse( 100, $e->getMessage(), null );
return $result;
}

View File

@@ -79,7 +79,7 @@ class WebEntryEventMapBuilder
$tMap->addColumn('DYN_UID', 'DynUid', 'string', CreoleTypes::VARCHAR, false, 32);
$tMap->addColumn('USR_UID', 'UsrUid', 'string', CreoleTypes::VARCHAR, true, 32);
$tMap->addColumn('USR_UID', 'UsrUid', 'string', CreoleTypes::VARCHAR, false, 32);
$tMap->addColumn('WEE_STATUS', 'WeeStatus', 'string', CreoleTypes::VARCHAR, true, 10);

View File

@@ -55,7 +55,7 @@ abstract class BaseWebEntry extends BaseObject implements Persistent
* The value for the usr_uid field.
* @var string
*/
protected $usr_uid = '';
protected $usr_uid;
/**
* The value for the we_method field.
@@ -560,7 +560,7 @@ abstract class BaseWebEntry extends BaseObject implements Persistent
$v = (string) $v;
}
if ($this->usr_uid !== $v || $v === '') {
if ($this->usr_uid !== $v) {
$this->usr_uid = $v;
$this->modifiedColumns[] = WebEntryPeer::USR_UID;
}

View File

@@ -3334,7 +3334,7 @@
<column name="PRO_UID" type="VARCHAR" size="32" required="true" />
<column name="TAS_UID" type="VARCHAR" size="32" required="true" />
<column name="DYN_UID" type="VARCHAR" size="32" required="false" />
<column name="USR_UID" type="VARCHAR" size="32" default="" />
<column name="USR_UID" type="VARCHAR" size="32" required="false" />
<column name="WE_METHOD" type="VARCHAR" size="4" default="HTML" />
<column name="WE_INPUT_DOCUMENT_ACCESS" type="INTEGER" default="0" />
<column name="WE_DATA" type="LONGVARCHAR" />
@@ -4805,7 +4805,7 @@
<column name="EVN_UID" type="VARCHAR" size="32" required="true" />
<column name="ACT_UID" type="VARCHAR" size="32" required="true" />
<column name="DYN_UID" type="VARCHAR" size="32" required="false" />
<column name="USR_UID" type="VARCHAR" size="32" required="true" />
<column name="USR_UID" type="VARCHAR" size="32" required="false" />
<column name="WEE_STATUS" type="VARCHAR" size="10" required="true" default="ENABLED" />
<column name="WEE_WE_UID" type="VARCHAR" size="32" required="true" default="" />
<column name="WEE_WE_TAS_UID" type="VARCHAR" size="32" required="true" default="" />

View File

@@ -1653,7 +1653,7 @@ CREATE TABLE `WEB_ENTRY`
`PRO_UID` VARCHAR(32) NOT NULL,
`TAS_UID` VARCHAR(32) NOT NULL,
`DYN_UID` VARCHAR(32),
`USR_UID` VARCHAR(32) default '',
`USR_UID` VARCHAR(32),
`WE_METHOD` VARCHAR(4) default 'HTML',
`WE_INPUT_DOCUMENT_ACCESS` INTEGER default 0,
`WE_DATA` MEDIUMTEXT,
@@ -2735,7 +2735,7 @@ CREATE TABLE `WEB_ENTRY_EVENT`
`EVN_UID` VARCHAR(32) NOT NULL,
`ACT_UID` VARCHAR(32) NOT NULL,
`DYN_UID` VARCHAR(32),
`USR_UID` VARCHAR(32) NOT NULL,
`USR_UID` VARCHAR(32),
`WEE_STATUS` VARCHAR(10) default 'ENABLED' NOT NULL,
`WEE_WE_UID` VARCHAR(32) default '' NOT NULL,
`WEE_WE_TAS_UID` VARCHAR(32) default '' NOT NULL,

View File

@@ -171,7 +171,6 @@ class Process
$fieldNameAux = (isset($arrayFieldNameForException[$arrayFieldDefinition[$fieldName]['fieldNameAux']]))? $arrayFieldNameForException[$arrayFieldDefinition[$fieldName]['fieldNameAux']] : $fieldName;
if ($arrayFieldDefinition[$fieldName]["required"] && !isset($arrayData[$fieldName])) {
var_dump($fieldNameAux);
throw new \Exception(\G::LoadTranslation('ID_UNDEFINED_VALUE_IS_REQUIRED', [$fieldNameAux]));
}
}

View File

@@ -8,7 +8,7 @@ class WebEntry
"TAS_UID" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "taskUid"),
"DYN_UID" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "dynaFormUid"),
"USR_UID" => array("type" => "string", "required" => false, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "userUid"),
"USR_UID" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "userUid"),
"WE_TITLE" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "webEntryTitle"),
"WE_DESCRIPTION" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "webEntryDescription"),
"WE_METHOD" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array("WS", "HTML"), "fieldNameAux" => "webEntryMethod"),
@@ -16,7 +16,7 @@ class WebEntry
);
private $arrayUserFieldDefinition = array(
"USR_UID" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "userUid")
"USR_UID" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "userUid")
);
private $formatFieldNameInUppercase = true;
@@ -293,7 +293,7 @@ class WebEntry
}
}
if ($arrayDataMain["WE_METHOD"] == "WS" && isset($arrayData["TAS_UID"])) {
if ($arrayDataMain["WE_METHOD"] == "WS" && isset($arrayData["TAS_UID"]) && (!isset($arrayData["WE_AUTHENTICATION"]) || $arrayData["WE_AUTHENTICATION"]!='LOGIN_REQUIRED')) {
$task = new \Tasks();
if ($task->assignUsertoTask($arrayData["TAS_UID"]) == 0) {

View File

@@ -9,7 +9,7 @@ class WebEntryEvent
"EVN_UID" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "eventUid"),
"ACT_UID" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "activityUid"),
"DYN_UID" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "dynaFormUid"),
"USR_UID" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "userUid"),
"USR_UID" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "userUid"),
"WEE_TITLE" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "webEntryEventTitle"),
"WEE_DESCRIPTION" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "webEntryEventDescription"),
@@ -260,6 +260,15 @@ class WebEntryEvent
//Verify data - Field definition
$process = new \ProcessMaker\BusinessModel\Process();
//Dependent fields:
if (!isset($arrayData['WE_AUTHENTICATION']) || $arrayData['WE_AUTHENTICATION']
== 'ANONYMOUS') {
$this->arrayFieldDefinition['USR_UID']['required'] = true;
}
if (!isset($arrayData['WE_TYPE']) || $arrayData['WE_TYPE']
== 'SINGLE') {
$this->arrayFieldDefinition['DYN_UID']['required'] = true;
}
$process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, $flagInsert);
@@ -371,8 +380,9 @@ class WebEntryEvent
//Task - User
$task = new \Tasks();
$result = $task->assignUser($this->webEntryEventWebEntryTaskUid, $userUid, 1);
if (!(isset($arrayData['WE_AUTHENTICATION']) && $arrayData['WE_AUTHENTICATION']==='LOGIN_REQUIRED')) {
$task->assignUser($this->webEntryEventWebEntryTaskUid, $userUid, 1);
}
//Route
$workflow = \ProcessMaker\Project\Workflow::load($projectUid);
@@ -491,6 +501,14 @@ class WebEntryEvent
$arrayData["WEE_STATUS"] = "ENABLED";
}
if (!array_key_exists('USR_UID', $arrayData)) {
$arrayData['USR_UID'] = null;
}
if (!isset($arrayData["WEE_TITLE"])) {
$arrayData["WEE_TITLE"] = null;
}
//Verify data
$process->throwExceptionIfNotExistsProcess($projectUid, $this->arrayFieldNameForException["projectUid"]);

View File

@@ -32,6 +32,8 @@ class WebEntryEvent extends Api
/**
* @url GET /:prj_uid/web-entry-events
* @access protected
* @class AccessControl {@permission PM_FACTORY}
*
* @param string $prj_uid {@min 32}{@max 32}
*/