Use observations
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
use WebEntryEventPeer;
|
||||
@@ -6,23 +7,91 @@ use ProcessPeer;
|
||||
use Criteria;
|
||||
use WebEntryPeer;
|
||||
use Exception;
|
||||
use G;
|
||||
use BpmnFlowPeer;
|
||||
|
||||
class WebEntryEvent
|
||||
{
|
||||
private $arrayFieldDefinition = array(
|
||||
"WEE_UID" => array("type" => "string", "required" => false, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "webEntryEventUid"),
|
||||
"WEE_UID" => array(
|
||||
"type" => "string",
|
||||
"required" => false,
|
||||
"empty" => false,
|
||||
"defaultValues" => array(),
|
||||
"fieldNameAux" => "webEntryEventUid"
|
||||
),
|
||||
|
||||
"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" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "userUid"),
|
||||
"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" => false,
|
||||
"empty" => true,
|
||||
"defaultValues" => array(),
|
||||
"fieldNameAux" => "userUid"
|
||||
),
|
||||
|
||||
"WEE_TITLE" => array("type" => "string", "required" => false, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "webEntryEventTitle"),
|
||||
"WEE_DESCRIPTION" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "webEntryEventDescription"),
|
||||
"WEE_STATUS" => array("type" => "string", "required" => false, "empty" => false, "defaultValues" => array("ENABLED", "DISABLED"), "fieldNameAux" => "webEntryEventStatus"),
|
||||
"WE_LINK_SKIN" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "webEntryEventSkin"),
|
||||
"WE_LINK_LANGUAGE" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "webEntryEventLanguage"),
|
||||
"WE_LINK_DOMAIN" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "webEntryEventDomain"),
|
||||
"WEE_TITLE" => array(
|
||||
"type" => "string",
|
||||
"required" => false,
|
||||
"empty" => false,
|
||||
"defaultValues" => array(),
|
||||
"fieldNameAux" => "webEntryEventTitle"
|
||||
),
|
||||
"WEE_DESCRIPTION" => array(
|
||||
"type" => "string",
|
||||
"required" => false,
|
||||
"empty" => true,
|
||||
"defaultValues" => array(),
|
||||
"fieldNameAux" => "webEntryEventDescription"
|
||||
),
|
||||
"WEE_STATUS" => array(
|
||||
"type" => "string",
|
||||
"required" => false,
|
||||
"empty" => false,
|
||||
"defaultValues" => array("ENABLED", "DISABLED"),
|
||||
"fieldNameAux" => "webEntryEventStatus"
|
||||
),
|
||||
"WE_LINK_SKIN" => array(
|
||||
"type" => "string",
|
||||
"required" => false,
|
||||
"empty" => true,
|
||||
"defaultValues" => array(),
|
||||
"fieldNameAux" => "webEntryEventSkin"
|
||||
),
|
||||
"WE_LINK_LANGUAGE" => array(
|
||||
"type" => "string",
|
||||
"required" => false,
|
||||
"empty" => true,
|
||||
"defaultValues" => array(),
|
||||
"fieldNameAux" => "webEntryEventLanguage"
|
||||
),
|
||||
"WE_LINK_DOMAIN" => array(
|
||||
"type" => "string",
|
||||
"required" => false,
|
||||
"empty" => true,
|
||||
"defaultValues" => array(),
|
||||
"fieldNameAux" => "webEntryEventDomain"
|
||||
),
|
||||
);
|
||||
|
||||
private $formatFieldNameInUppercase = true;
|
||||
@@ -49,7 +118,7 @@ class WebEntryEvent
|
||||
foreach ($this->arrayFieldDefinition as $key => $value) {
|
||||
$this->arrayFieldNameForException[$value["fieldNameAux"]] = $key;
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -59,7 +128,8 @@ class WebEntryEvent
|
||||
*
|
||||
* @param bool $flag Value that set the format
|
||||
*
|
||||
* return void
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function setFormatFieldNameInUppercase($flag)
|
||||
{
|
||||
@@ -69,7 +139,7 @@ class WebEntryEvent
|
||||
$this->formatFieldNameInUppercase = $flag;
|
||||
|
||||
$this->setArrayFieldNameForException($this->arrayFieldNameForException);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -79,7 +149,8 @@ class WebEntryEvent
|
||||
*
|
||||
* @param array $arrayData Data with the fields
|
||||
*
|
||||
* return void
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function setArrayFieldNameForException(array $arrayData)
|
||||
{
|
||||
@@ -89,7 +160,7 @@ class WebEntryEvent
|
||||
foreach ($arrayData as $key => $value) {
|
||||
$this->arrayFieldNameForException[$key] = $this->getFieldNameByFormatFieldName($value);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -99,13 +170,14 @@ class WebEntryEvent
|
||||
*
|
||||
* @param string $fieldName Field name
|
||||
*
|
||||
* return string Return the field name according the format
|
||||
* @return string Return the field name according the format
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getFieldNameByFormatFieldName($fieldName)
|
||||
{
|
||||
try {
|
||||
return ($this->formatFieldNameInUppercase) ? strtoupper($fieldName) : strtolower($fieldName);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -115,15 +187,16 @@ class WebEntryEvent
|
||||
*
|
||||
* @param string $webEntryEventUid Unique id of WebEntry-Event
|
||||
*
|
||||
* return bool Return true if exists the WebEntry-Event, false otherwise
|
||||
* @return bool Return true if exists the WebEntry-Event, false otherwise
|
||||
* @throws Exception
|
||||
*/
|
||||
public function exists($webEntryEventUid)
|
||||
{
|
||||
try {
|
||||
$obj = \WebEntryEventPeer::retrieveByPK($webEntryEventUid);
|
||||
$obj = WebEntryEventPeer::retrieveByPK($webEntryEventUid);
|
||||
|
||||
return (!is_null($obj)) ? true : false;
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -135,26 +208,27 @@ class WebEntryEvent
|
||||
* @param string $eventUid Unique id of Event
|
||||
* @param string $webEntryEventUidToExclude Unique id of WebEntry-Event to exclude
|
||||
*
|
||||
* return bool Return true if exists the Event of a WebEntry-Event, false otherwise
|
||||
* @return bool Return true if exists the Event of a WebEntry-Event, false otherwise
|
||||
* @throws Exception
|
||||
*/
|
||||
public function existsEvent($projectUid, $eventUid, $webEntryEventUidToExclude = "")
|
||||
{
|
||||
try {
|
||||
$criteria = new \Criteria("workflow");
|
||||
$criteria = new Criteria("workflow");
|
||||
|
||||
$criteria->addSelectColumn(\WebEntryEventPeer::WEE_UID);
|
||||
$criteria->add(\WebEntryEventPeer::PRJ_UID, $projectUid, \Criteria::EQUAL);
|
||||
$criteria->addSelectColumn(WebEntryEventPeer::WEE_UID);
|
||||
$criteria->add(WebEntryEventPeer::PRJ_UID, $projectUid, Criteria::EQUAL);
|
||||
|
||||
if ($webEntryEventUidToExclude != "") {
|
||||
$criteria->add(\WebEntryEventPeer::WEE_UID, $webEntryEventUidToExclude, \Criteria::NOT_EQUAL);
|
||||
$criteria->add(WebEntryEventPeer::WEE_UID, $webEntryEventUidToExclude, Criteria::NOT_EQUAL);
|
||||
}
|
||||
|
||||
$criteria->add(\WebEntryEventPeer::EVN_UID, $eventUid, \Criteria::EQUAL);
|
||||
$criteria->add(WebEntryEventPeer::EVN_UID, $eventUid, Criteria::EQUAL);
|
||||
|
||||
$rsCriteria = \WebEntryEventPeer::doSelectRS($criteria);
|
||||
$rsCriteria = WebEntryEventPeer::doSelectRS($criteria);
|
||||
|
||||
return ($rsCriteria->next()) ? true : false;
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -166,24 +240,25 @@ class WebEntryEvent
|
||||
* @param string $webEntryEventTitle Title
|
||||
* @param string $webEntryEventUidToExclude Unique id of WebEntry-Event to exclude
|
||||
*
|
||||
* return bool Return true if exists the title of a WebEntry-Event, false otherwise
|
||||
* @return bool Return true if exists the title of a WebEntry-Event, false otherwise
|
||||
* @throws Exception
|
||||
*/
|
||||
public function existsTitle($projectUid, $webEntryEventTitle, $webEntryEventUidToExclude = "")
|
||||
{
|
||||
try {
|
||||
$criteria = new \Criteria("workflow");
|
||||
$criteria = new Criteria("workflow");
|
||||
|
||||
$criteria->addSelectColumn(\WebEntryEventPeer::WEE_UID);
|
||||
$criteria->add(\WebEntryEventPeer::PRJ_UID, $projectUid, \Criteria::EQUAL);
|
||||
$criteria->addSelectColumn(WebEntryEventPeer::WEE_UID);
|
||||
$criteria->add(WebEntryEventPeer::PRJ_UID, $projectUid, Criteria::EQUAL);
|
||||
|
||||
if ($webEntryEventUidToExclude != "") {
|
||||
$criteria->add(\WebEntryEventPeer::WEE_UID, $webEntryEventUidToExclude, \Criteria::NOT_EQUAL);
|
||||
$criteria->add(WebEntryEventPeer::WEE_UID, $webEntryEventUidToExclude, Criteria::NOT_EQUAL);
|
||||
}
|
||||
$criteria->add(\WebEntryEventPeer::WEE_TITLE, $webEntryEventTitle);
|
||||
$rsCriteria = \WebEntryEventPeer::doSelectRS($criteria);
|
||||
$criteria->add(WebEntryEventPeer::WEE_TITLE, $webEntryEventTitle);
|
||||
$rsCriteria = WebEntryEventPeer::doSelectRS($criteria);
|
||||
|
||||
return ($rsCriteria->next()) ? true : false;
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -194,15 +269,17 @@ class WebEntryEvent
|
||||
* @param string $webEntryEventUid Unique id of WebEntry-Event
|
||||
* @param string $fieldNameForException Field name for the exception
|
||||
*
|
||||
* return void Throw exception if does not exists the WebEntry-Event
|
||||
* @return void Throw exception if does not exists the WebEntry-Event
|
||||
* @throws Exception
|
||||
*/
|
||||
public function throwExceptionIfNotExistsWebEntryEvent($webEntryEventUid, $fieldNameForException)
|
||||
{
|
||||
try {
|
||||
if (!$this->exists($webEntryEventUid)) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_WEB_ENTRY_EVENT_DOES_NOT_EXIST", array($fieldNameForException, $webEntryEventUid)));
|
||||
throw new Exception(G::LoadTranslation("ID_WEB_ENTRY_EVENT_DOES_NOT_EXIST",
|
||||
array($fieldNameForException, $webEntryEventUid)));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -215,15 +292,21 @@ class WebEntryEvent
|
||||
* @param string $fieldNameForException Field name for the exception
|
||||
* @param string $webEntryEventUidToExclude Unique id of WebEntry-Event to exclude
|
||||
*
|
||||
* return void Throw exception if is registered the Event
|
||||
* @return void Throw exception if is registered the Event
|
||||
* @throws Exception
|
||||
*/
|
||||
public function throwExceptionIfEventIsRegistered($projectUid, $eventUid, $fieldNameForException, $webEntryEventUidToExclude = "")
|
||||
{
|
||||
public function throwExceptionIfEventIsRegistered(
|
||||
$projectUid,
|
||||
$eventUid,
|
||||
$fieldNameForException,
|
||||
$webEntryEventUidToExclude = ""
|
||||
) {
|
||||
try {
|
||||
if ($this->existsEvent($projectUid, $eventUid, $webEntryEventUidToExclude)) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_WEB_ENTRY_EVENT_ALREADY_REGISTERED", array($fieldNameForException, $eventUid)));
|
||||
throw new Exception(G::LoadTranslation("ID_WEB_ENTRY_EVENT_ALREADY_REGISTERED",
|
||||
array($fieldNameForException, $eventUid)));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -236,15 +319,21 @@ class WebEntryEvent
|
||||
* @param string $fieldNameForException Field name for the exception
|
||||
* @param string $webEntryEventUidToExclude Unique id of WebEntry-Event to exclude
|
||||
*
|
||||
* return void Throw exception if exists the title of a WebEntry-Event
|
||||
* @return void Throw exception if exists the title of a WebEntry-Event
|
||||
* @throws Exception
|
||||
*/
|
||||
public function throwExceptionIfExistsTitle($projectUid, $webEntryEventTitle, $fieldNameForException, $webEntryEventUidToExclude = "")
|
||||
{
|
||||
public function throwExceptionIfExistsTitle(
|
||||
$projectUid,
|
||||
$webEntryEventTitle,
|
||||
$fieldNameForException,
|
||||
$webEntryEventUidToExclude = ""
|
||||
) {
|
||||
try {
|
||||
if ($this->existsTitle($projectUid, $webEntryEventTitle, $webEntryEventUidToExclude)) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_WEB_ENTRY_EVENT_TITLE_ALREADY_EXISTS", array($fieldNameForException, $webEntryEventTitle)));
|
||||
throw new Exception(G::LoadTranslation("ID_WEB_ENTRY_EVENT_TITLE_ALREADY_EXISTS",
|
||||
array($fieldNameForException, $webEntryEventTitle)));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -256,13 +345,15 @@ class WebEntryEvent
|
||||
* @param string $projectUid Unique id of Project
|
||||
* @param array $arrayData Data
|
||||
*
|
||||
* return void Throw exception if data has an invalid value
|
||||
* @return void Throw exception if data has an invalid value
|
||||
* @throws Exception
|
||||
*/
|
||||
public function throwExceptionIfDataIsInvalid($webEntryEventUid, $projectUid, array $arrayData)
|
||||
{
|
||||
try {
|
||||
//Set variables
|
||||
$arrayWebEntryEventData = ($webEntryEventUid == "")? array() : $this->getWebEntryEvent($webEntryEventUid, true);
|
||||
$arrayWebEntryEventData = ($webEntryEventUid == "") ? array() : $this->getWebEntryEvent($webEntryEventUid,
|
||||
true);
|
||||
$flagInsert = ($webEntryEventUid == "") ? true : false;
|
||||
|
||||
$arrayFinalData = array_merge($arrayWebEntryEventData, $arrayData);
|
||||
@@ -300,71 +391,79 @@ class WebEntryEvent
|
||||
$this->arrayFieldDefinition['WE_LINK_LANGUAGE']['defaultValues'] = $languages;
|
||||
}
|
||||
|
||||
$process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, $flagInsert);
|
||||
$process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition,
|
||||
$this->arrayFieldNameForException, $flagInsert);
|
||||
|
||||
//Verify data
|
||||
if (isset($arrayData["EVN_UID"])) {
|
||||
$this->throwExceptionIfEventIsRegistered($projectUid, $arrayData["EVN_UID"], $this->arrayFieldNameForException["eventUid"], $webEntryEventUid);
|
||||
$this->throwExceptionIfEventIsRegistered($projectUid, $arrayData["EVN_UID"],
|
||||
$this->arrayFieldNameForException["eventUid"], $webEntryEventUid);
|
||||
}
|
||||
|
||||
if (isset($arrayData["EVN_UID"])) {
|
||||
$obj = \BpmnEventPeer::retrieveByPK($arrayData["EVN_UID"]);
|
||||
|
||||
if (is_null($obj)) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_EVENT_NOT_EXIST", array($this->arrayFieldNameForException["eventUid"], $arrayData["EVN_UID"])));
|
||||
throw new Exception(G::LoadTranslation("ID_EVENT_NOT_EXIST",
|
||||
array($this->arrayFieldNameForException["eventUid"], $arrayData["EVN_UID"])));
|
||||
}
|
||||
|
||||
if (($obj->getEvnType() != "START") || ($obj->getEvnType() == "START" && $obj->getEvnMarker() != "EMPTY")) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_EVENT_NOT_IS_START_EVENT", array($this->arrayFieldNameForException["eventUid"], $arrayData["EVN_UID"])));
|
||||
throw new Exception(G::LoadTranslation("ID_EVENT_NOT_IS_START_EVENT",
|
||||
array($this->arrayFieldNameForException["eventUid"], $arrayData["EVN_UID"])));
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($arrayData["WEE_TITLE"])) {
|
||||
$this->throwExceptionIfExistsTitle($projectUid, $arrayData["WEE_TITLE"], $this->arrayFieldNameForException["webEntryEventTitle"], $webEntryEventUid);
|
||||
$this->throwExceptionIfExistsTitle($projectUid, $arrayData["WEE_TITLE"],
|
||||
$this->arrayFieldNameForException["webEntryEventTitle"], $webEntryEventUid);
|
||||
}
|
||||
|
||||
if (isset($arrayData["ACT_UID"])) {
|
||||
$bpmn = new \ProcessMaker\Project\Bpmn();
|
||||
|
||||
if (!$bpmn->activityExists($arrayData["ACT_UID"])) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_ACTIVITY_DOES_NOT_EXIST", array($this->arrayFieldNameForException["activityUid"], $arrayData["ACT_UID"])));
|
||||
throw new Exception(G::LoadTranslation("ID_ACTIVITY_DOES_NOT_EXIST",
|
||||
array($this->arrayFieldNameForException["activityUid"], $arrayData["ACT_UID"])));
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($arrayData["EVN_UID"]) || isset($arrayData["ACT_UID"])) {
|
||||
$criteria = new \Criteria("workflow");
|
||||
$criteria = new Criteria("workflow");
|
||||
|
||||
$criteria->addSelectColumn(\BpmnFlowPeer::FLO_UID);
|
||||
$criteria->add(\BpmnFlowPeer::FLO_ELEMENT_ORIGIN, $arrayFinalData["EVN_UID"], \Criteria::EQUAL);
|
||||
$criteria->add(\BpmnFlowPeer::FLO_ELEMENT_ORIGIN_TYPE, "bpmnEvent", \Criteria::EQUAL);
|
||||
$criteria->add(\BpmnFlowPeer::FLO_ELEMENT_DEST, $arrayFinalData["ACT_UID"], \Criteria::EQUAL);
|
||||
$criteria->add(\BpmnFlowPeer::FLO_ELEMENT_DEST_TYPE, "bpmnActivity", \Criteria::EQUAL);
|
||||
$criteria->addSelectColumn(BpmnFlowPeer::FLO_UID);
|
||||
$criteria->add(BpmnFlowPeer::FLO_ELEMENT_ORIGIN, $arrayFinalData["EVN_UID"], Criteria::EQUAL);
|
||||
$criteria->add(BpmnFlowPeer::FLO_ELEMENT_ORIGIN_TYPE, "bpmnEvent", Criteria::EQUAL);
|
||||
$criteria->add(BpmnFlowPeer::FLO_ELEMENT_DEST, $arrayFinalData["ACT_UID"], Criteria::EQUAL);
|
||||
$criteria->add(BpmnFlowPeer::FLO_ELEMENT_DEST_TYPE, "bpmnActivity", Criteria::EQUAL);
|
||||
|
||||
$rsCriteria = \BpmnFlowPeer::doSelectRS($criteria);
|
||||
$rsCriteria = BpmnFlowPeer::doSelectRS($criteria);
|
||||
|
||||
if (!$rsCriteria->next()) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_WEB_ENTRY_EVENT_FLOW_EVENT_TO_ACTIVITY_DOES_NOT_EXIST"));
|
||||
throw new Exception(G::LoadTranslation("ID_WEB_ENTRY_EVENT_FLOW_EVENT_TO_ACTIVITY_DOES_NOT_EXIST"));
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($arrayData["DYN_UID"])) {
|
||||
$dynaForm = new \ProcessMaker\BusinessModel\DynaForm();
|
||||
|
||||
$dynaForm->throwExceptionIfNotExistsDynaForm($arrayData["DYN_UID"], $projectUid, $this->arrayFieldNameForException["dynaFormUid"]);
|
||||
$dynaForm->throwExceptionIfNotExistsDynaForm($arrayData["DYN_UID"], $projectUid,
|
||||
$this->arrayFieldNameForException["dynaFormUid"]);
|
||||
}
|
||||
|
||||
if (!empty($arrayData["USR_UID"])) {
|
||||
$process->throwExceptionIfNotExistsUser($arrayData["USR_UID"], $this->arrayFieldNameForException["userUid"]);
|
||||
$process->throwExceptionIfNotExistsUser($arrayData["USR_UID"],
|
||||
$this->arrayFieldNameForException["userUid"]);
|
||||
}
|
||||
|
||||
if ($arrayData["WE_TYPE"] === "SINGLE" && empty($arrayData["DYN_UID"])) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_SELECT_DYNAFORM_USE_IN_CASE"));
|
||||
throw new Exception(G::LoadTranslation("ID_SELECT_DYNAFORM_USE_IN_CASE"));
|
||||
}
|
||||
|
||||
if ($arrayData["WE_CALLBACK"] === "CUSTOM" && empty($arrayData["WE_CALLBACK_URL"])) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_ENTER_VALID_URL"));
|
||||
throw new Exception(G::LoadTranslation("ID_ENTER_VALID_URL"));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -378,6 +477,7 @@ class WebEntryEvent
|
||||
public static function getTaskUidFromEvnUid($eventUid)
|
||||
{
|
||||
$prefix = "wee-";
|
||||
|
||||
return $prefix . substr($eventUid, (32 - strlen($prefix)) * -1);
|
||||
}
|
||||
|
||||
@@ -393,10 +493,20 @@ class WebEntryEvent
|
||||
* @param string $description WebEntry, description
|
||||
* @param string $userUidCreator WebEntry, unique id of creator User
|
||||
*
|
||||
* return void
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function createWebEntry($projectUid, $eventUid, $activityUid, $dynaFormUid, $userUid, $title, $description, $userUidCreator, $arrayData=[])
|
||||
{
|
||||
public function createWebEntry(
|
||||
$projectUid,
|
||||
$eventUid,
|
||||
$activityUid,
|
||||
$dynaFormUid,
|
||||
$userUid,
|
||||
$title,
|
||||
$description,
|
||||
$userUidCreator,
|
||||
$arrayData = []
|
||||
) {
|
||||
try {
|
||||
$bpmn = new \ProcessMaker\Project\Bpmn();
|
||||
|
||||
@@ -427,9 +537,18 @@ class WebEntryEvent
|
||||
//Task - Step
|
||||
$step = new \Step();
|
||||
|
||||
$stepUid = $step->create(array("PRO_UID" => $projectUid, "TAS_UID" => $this->webEntryEventWebEntryTaskUid));
|
||||
$stepUid = $step->create(array(
|
||||
"PRO_UID" => $projectUid,
|
||||
"TAS_UID" => $this->webEntryEventWebEntryTaskUid
|
||||
));
|
||||
if (!empty($dynaFormUid)) {
|
||||
$result = $step->update(array("STEP_UID" => $stepUid, "STEP_TYPE_OBJ" => "DYNAFORM", "STEP_UID_OBJ" => $dynaFormUid, "STEP_POSITION" => 1, "STEP_MODE" => "EDIT"));
|
||||
$result = $step->update(array(
|
||||
"STEP_UID" => $stepUid,
|
||||
"STEP_TYPE_OBJ" => "DYNAFORM",
|
||||
"STEP_UID_OBJ" => $dynaFormUid,
|
||||
"STEP_POSITION" => 1,
|
||||
"STEP_MODE" => "EDIT"
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -485,7 +604,7 @@ class WebEntryEvent
|
||||
);
|
||||
|
||||
$this->webEntryEventWebEntryUid = $arrayWebEntryData[$this->getFieldNameByFormatFieldName("WE_UID")];
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -496,7 +615,8 @@ class WebEntryEvent
|
||||
* @param string $webEntryUid Unique id of WebEntry
|
||||
* @param string $webEntryTaskUid WebEntry, unique id of Task
|
||||
*
|
||||
* return void
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function deleteWebEntry($webEntryUid, $webEntryTaskUid)
|
||||
{
|
||||
@@ -512,13 +632,13 @@ class WebEntryEvent
|
||||
}
|
||||
|
||||
if ($webEntryUid != "") {
|
||||
$obj = \WebEntryPeer::retrieveByPK($webEntryUid);
|
||||
$obj = WebEntryPeer::retrieveByPK($webEntryUid);
|
||||
|
||||
if (!is_null($obj)) {
|
||||
$this->webEntry->delete($webEntryUid);
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -530,7 +650,8 @@ class WebEntryEvent
|
||||
* @param string $userUidCreator Unique id of creator User
|
||||
* @param array $arrayData Data
|
||||
*
|
||||
* return array Return data of the new WebEntry-Event created
|
||||
* @return array Return data of the new WebEntry-Event created
|
||||
* @throws Exception
|
||||
*/
|
||||
public function create($projectUid, $userUidCreator, array $arrayData)
|
||||
{
|
||||
@@ -618,12 +739,14 @@ class WebEntryEvent
|
||||
|
||||
//Set WEE_TITLE
|
||||
if (isset($arrayData["WEE_TITLE"])) {
|
||||
$result = \Content::addContent("WEE_TITLE", "", $webEntryEventUid, SYS_LANG, $arrayData["WEE_TITLE"]);
|
||||
$result = \Content::addContent("WEE_TITLE", "", $webEntryEventUid, SYS_LANG,
|
||||
$arrayData["WEE_TITLE"]);
|
||||
}
|
||||
|
||||
//Set WEE_DESCRIPTION
|
||||
if (isset($arrayData["WEE_DESCRIPTION"])) {
|
||||
$result = \Content::addContent("WEE_DESCRIPTION", "", $webEntryEventUid, SYS_LANG, $arrayData["WEE_DESCRIPTION"]);
|
||||
$result = \Content::addContent("WEE_DESCRIPTION", "", $webEntryEventUid, SYS_LANG,
|
||||
$arrayData["WEE_DESCRIPTION"]);
|
||||
}
|
||||
|
||||
//Return
|
||||
@@ -635,16 +758,16 @@ class WebEntryEvent
|
||||
$msg = $msg . (($msg != "") ? "\n" : "") . $validationFailure->getMessage();
|
||||
}
|
||||
|
||||
throw new \Exception(\G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . (($msg != "")? "\n" . $msg : ""));
|
||||
throw new Exception(G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . (($msg != "") ? "\n" . $msg : ""));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$cnn->rollback();
|
||||
|
||||
$this->deleteWebEntry($this->webEntryEventWebEntryUid, $this->webEntryEventWebEntryTaskUid);
|
||||
|
||||
throw $e;
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -656,7 +779,8 @@ class WebEntryEvent
|
||||
* @param string $userUidUpdater Unique id of updater User
|
||||
* @param array $arrayData Data
|
||||
*
|
||||
* return array Return data of the WebEntry-Event updated
|
||||
* @return array Return data of the WebEntry-Event updated
|
||||
* @throws Exception
|
||||
*/
|
||||
public function update($webEntryEventUid, $userUidUpdater, array $arrayData)
|
||||
{
|
||||
@@ -683,7 +807,8 @@ class WebEntryEvent
|
||||
$arrayFinalData = array_merge($arrayWebEntryEventData, $arrayData);
|
||||
|
||||
//Verify data
|
||||
$this->throwExceptionIfNotExistsWebEntryEvent($webEntryEventUid, $this->arrayFieldNameForException["webEntryEventUid"]);
|
||||
$this->throwExceptionIfNotExistsWebEntryEvent($webEntryEventUid,
|
||||
$this->arrayFieldNameForException["webEntryEventUid"]);
|
||||
|
||||
$this->throwExceptionIfDataIsInvalid($webEntryEventUid, $arrayWebEntryEventData["PRJ_UID"], $arrayData);
|
||||
|
||||
@@ -704,7 +829,7 @@ class WebEntryEvent
|
||||
//Delete
|
||||
$step = new \Step();
|
||||
|
||||
$criteria = new \Criteria("workflow");
|
||||
$criteria = new Criteria("workflow");
|
||||
|
||||
$criteria->add(\StepPeer::TAS_UID, $arrayWebEntryEventData["WEE_WE_TAS_UID"]);
|
||||
|
||||
@@ -720,8 +845,17 @@ class WebEntryEvent
|
||||
//Add
|
||||
$step = new \Step();
|
||||
|
||||
$stepUid = $step->create(array("PRO_UID" => $arrayWebEntryEventData["PRJ_UID"], "TAS_UID" => $arrayWebEntryEventData["WEE_WE_TAS_UID"]));
|
||||
$result = $step->update(array("STEP_UID" => $stepUid, "STEP_TYPE_OBJ" => "DYNAFORM", "STEP_UID_OBJ" => $arrayData["DYN_UID"], "STEP_POSITION" => 1, "STEP_MODE" => "EDIT"));
|
||||
$stepUid = $step->create(array(
|
||||
"PRO_UID" => $arrayWebEntryEventData["PRJ_UID"],
|
||||
"TAS_UID" => $arrayWebEntryEventData["WEE_WE_TAS_UID"]
|
||||
));
|
||||
$result = $step->update(array(
|
||||
"STEP_UID" => $stepUid,
|
||||
"STEP_TYPE_OBJ" => "DYNAFORM",
|
||||
"STEP_UID_OBJ" => $arrayData["DYN_UID"],
|
||||
"STEP_POSITION" => 1,
|
||||
"STEP_MODE" => "EDIT"
|
||||
));
|
||||
}
|
||||
|
||||
//Task - User
|
||||
@@ -729,7 +863,7 @@ class WebEntryEvent
|
||||
//Unassign
|
||||
$taskUser = new \TaskUser();
|
||||
|
||||
$criteria = new \Criteria("workflow");
|
||||
$criteria = new Criteria("workflow");
|
||||
|
||||
$criteria->add(\TaskUserPeer::TAS_UID, $arrayWebEntryEventData["WEE_WE_TAS_UID"]);
|
||||
|
||||
@@ -739,11 +873,13 @@ class WebEntryEvent
|
||||
while ($rsCriteria->next()) {
|
||||
$row = $rsCriteria->getRow();
|
||||
|
||||
$result = $taskUser->remove($row["TAS_UID"], $row["USR_UID"], $row["TU_TYPE"], $row["TU_RELATION"]);
|
||||
$result = $taskUser->remove($row["TAS_UID"], $row["USR_UID"], $row["TU_TYPE"],
|
||||
$row["TU_RELATION"]);
|
||||
}
|
||||
|
||||
//Assign
|
||||
$result = $task->assignUser($arrayWebEntryEventData["WEE_WE_TAS_UID"], $arrayData["USR_UID"], 1);
|
||||
$result = $task->assignUser($arrayWebEntryEventData["WEE_WE_TAS_UID"], $arrayData["USR_UID"],
|
||||
1);
|
||||
}
|
||||
|
||||
//Route
|
||||
@@ -758,7 +894,8 @@ class WebEntryEvent
|
||||
//Add
|
||||
$workflow = \ProcessMaker\Project\Workflow::load($arrayWebEntryEventData["PRJ_UID"]);
|
||||
|
||||
$result = $workflow->addRoute($arrayWebEntryEventData["WEE_WE_TAS_UID"], $arrayData["ACT_UID"], "SEQUENTIAL");
|
||||
$result = $workflow->addRoute($arrayWebEntryEventData["WEE_WE_TAS_UID"], $arrayData["ACT_UID"],
|
||||
"SEQUENTIAL");
|
||||
}
|
||||
|
||||
//WebEntry
|
||||
@@ -788,12 +925,13 @@ class WebEntryEvent
|
||||
}
|
||||
|
||||
if (count($arrayDataAux) > 0) {
|
||||
$arrayDataAux = $this->webEntry->update($arrayWebEntryEventData["WEE_WE_UID"], $userUidUpdater, $arrayDataAux);
|
||||
$arrayDataAux = $this->webEntry->update($arrayWebEntryEventData["WEE_WE_UID"], $userUidUpdater,
|
||||
$arrayDataAux);
|
||||
}
|
||||
}
|
||||
|
||||
//WebEntry-Event
|
||||
$webEntryEvent = \WebEntryEventPeer::retrieveByPK($webEntryEventUid);
|
||||
$webEntryEvent = WebEntryEventPeer::retrieveByPK($webEntryEventUid);
|
||||
|
||||
$webEntryEvent->fromArray($arrayData, \BasePeer::TYPE_FIELDNAME);
|
||||
|
||||
@@ -806,12 +944,14 @@ class WebEntryEvent
|
||||
|
||||
//Set WEE_TITLE
|
||||
if (isset($arrayData["WEE_TITLE"])) {
|
||||
$result = \Content::addContent("WEE_TITLE", "", $webEntryEventUid, SYS_LANG, $arrayData["WEE_TITLE"]);
|
||||
$result = \Content::addContent("WEE_TITLE", "", $webEntryEventUid, SYS_LANG,
|
||||
$arrayData["WEE_TITLE"]);
|
||||
}
|
||||
|
||||
//Set WEE_DESCRIPTION
|
||||
if (isset($arrayData["WEE_DESCRIPTION"])) {
|
||||
$result = \Content::addContent("WEE_DESCRIPTION", "", $webEntryEventUid, SYS_LANG, $arrayData["WEE_DESCRIPTION"]);
|
||||
$result = \Content::addContent("WEE_DESCRIPTION", "", $webEntryEventUid, SYS_LANG,
|
||||
$arrayData["WEE_DESCRIPTION"]);
|
||||
}
|
||||
|
||||
//Return
|
||||
@@ -829,16 +969,16 @@ class WebEntryEvent
|
||||
$msg = $msg . (($msg != "") ? "\n" : "") . $validationFailure->getMessage();
|
||||
}
|
||||
|
||||
throw new \Exception(\G::LoadTranslation("ID_REGISTRY_CANNOT_BE_UPDATED") . (($msg != "")? "\n" . $msg : ""));
|
||||
throw new Exception(G::LoadTranslation("ID_REGISTRY_CANNOT_BE_UPDATED") . (($msg != "") ? "\n" . $msg : ""));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$cnn->rollback();
|
||||
|
||||
$this->deleteWebEntry($this->webEntryEventWebEntryUid, $this->webEntryEventWebEntryTaskUid);
|
||||
|
||||
throw $e;
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -848,13 +988,15 @@ class WebEntryEvent
|
||||
*
|
||||
* @param string $webEntryEventUid Unique id of WebEntry-Event
|
||||
*
|
||||
* return void
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function delete($webEntryEventUid)
|
||||
{
|
||||
try {
|
||||
//Verify data
|
||||
$this->throwExceptionIfNotExistsWebEntryEvent($webEntryEventUid, $this->arrayFieldNameForException["webEntryEventUid"]);
|
||||
$this->throwExceptionIfNotExistsWebEntryEvent($webEntryEventUid,
|
||||
$this->arrayFieldNameForException["webEntryEventUid"]);
|
||||
|
||||
//Set variables
|
||||
$arrayWebEntryEventData = $this->getWebEntryEvent($webEntryEventUid, true);
|
||||
@@ -863,12 +1005,12 @@ class WebEntryEvent
|
||||
$this->deleteWebEntry($arrayWebEntryEventData["WEE_WE_UID"], $arrayWebEntryEventData["WEE_WE_TAS_UID"]);
|
||||
|
||||
//Delete WebEntry-Event
|
||||
$criteria = new \Criteria("workflow");
|
||||
$criteria = new Criteria("workflow");
|
||||
|
||||
$criteria->add(\WebEntryEventPeer::WEE_UID, $webEntryEventUid, \Criteria::EQUAL);
|
||||
$criteria->add(WebEntryEventPeer::WEE_UID, $webEntryEventUid, Criteria::EQUAL);
|
||||
|
||||
$result = \WebEntryEventPeer::doDelete($criteria);
|
||||
} catch (\Exception $e) {
|
||||
$result = WebEntryEventPeer::doDelete($criteria);
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -880,40 +1022,41 @@ class WebEntryEvent
|
||||
* @link https://processmaker.atlassian.net/browse/PROD-181 Web Entry 2 Feature definition
|
||||
* @link URL description https://processmaker.atlassian.net/browse/PROD-1 Web Entry 1 Feature definition
|
||||
* @group webentry2
|
||||
* @return \Criteria
|
||||
* @throws \Exception
|
||||
* @return Criteria
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getWebEntryEventCriteria()
|
||||
{
|
||||
try {
|
||||
$criteria = new \Criteria("workflow");
|
||||
$criteria->addSelectColumn(\WebEntryEventPeer::WEE_UID);
|
||||
$criteria->addSelectColumn(\WebEntryEventPeer::PRJ_UID);
|
||||
$criteria->addSelectColumn(\WebEntryEventPeer::EVN_UID);
|
||||
$criteria->addSelectColumn(\WebEntryEventPeer::ACT_UID);
|
||||
$criteria->addSelectColumn(\WebEntryEventPeer::DYN_UID);
|
||||
$criteria->addSelectColumn(\WebEntryEventPeer::USR_UID);
|
||||
$criteria->addSelectColumn(\WebEntryEventPeer::WEE_TITLE);
|
||||
$criteria->addSelectColumn(\WebEntryEventPeer::WEE_DESCRIPTION);
|
||||
$criteria->addSelectColumn(\WebEntryEventPeer::WEE_STATUS);
|
||||
$criteria->addSelectColumn(\WebEntryEventPeer::WEE_WE_UID);
|
||||
$criteria->addSelectColumn(\WebEntryEventPeer::WEE_WE_TAS_UID);
|
||||
$criteria->addSelectColumn(\WebEntryPeer::WE_DATA . " AS WEE_WE_URL");
|
||||
$criteria->addSelectColumn(\WebEntryPeer::WE_CUSTOM_TITLE);
|
||||
$criteria->addSelectColumn(\WebEntryPeer::WE_TYPE);
|
||||
$criteria->addSelectColumn(\WebEntryPeer::WE_AUTHENTICATION);
|
||||
$criteria->addSelectColumn(\WebEntryPeer::WE_HIDE_INFORMATION_BAR);
|
||||
$criteria->addSelectColumn(\WebEntryPeer::WE_CALLBACK);
|
||||
$criteria->addSelectColumn(\WebEntryPeer::WE_CALLBACK_URL);
|
||||
$criteria->addSelectColumn(\WebEntryPeer::WE_LINK_GENERATION);
|
||||
$criteria->addSelectColumn(\WebEntryPeer::WE_LINK_SKIN);
|
||||
$criteria->addSelectColumn(\WebEntryPeer::WE_LINK_LANGUAGE);
|
||||
$criteria->addSelectColumn(\WebEntryPeer::WE_LINK_DOMAIN);
|
||||
$criteria->addSelectColumn(\WebEntryPeer::TAS_UID);
|
||||
$criteria->addSelectColumn(\WebEntryPeer::WE_SHOW_IN_NEW_CASE);
|
||||
$criteria->addJoin(\WebEntryEventPeer::WEE_WE_UID, \WebEntryPeer::WE_UID, \Criteria::LEFT_JOIN);
|
||||
$criteria = new Criteria("workflow");
|
||||
$criteria->addSelectColumn(WebEntryEventPeer::WEE_UID);
|
||||
$criteria->addSelectColumn(WebEntryEventPeer::PRJ_UID);
|
||||
$criteria->addSelectColumn(WebEntryEventPeer::EVN_UID);
|
||||
$criteria->addSelectColumn(WebEntryEventPeer::ACT_UID);
|
||||
$criteria->addSelectColumn(WebEntryEventPeer::DYN_UID);
|
||||
$criteria->addSelectColumn(WebEntryEventPeer::USR_UID);
|
||||
$criteria->addSelectColumn(WebEntryEventPeer::WEE_TITLE);
|
||||
$criteria->addSelectColumn(WebEntryEventPeer::WEE_DESCRIPTION);
|
||||
$criteria->addSelectColumn(WebEntryEventPeer::WEE_STATUS);
|
||||
$criteria->addSelectColumn(WebEntryEventPeer::WEE_WE_UID);
|
||||
$criteria->addSelectColumn(WebEntryEventPeer::WEE_WE_TAS_UID);
|
||||
$criteria->addSelectColumn(WebEntryPeer::WE_DATA . " AS WEE_WE_URL");
|
||||
$criteria->addSelectColumn(WebEntryPeer::WE_CUSTOM_TITLE);
|
||||
$criteria->addSelectColumn(WebEntryPeer::WE_TYPE);
|
||||
$criteria->addSelectColumn(WebEntryPeer::WE_AUTHENTICATION);
|
||||
$criteria->addSelectColumn(WebEntryPeer::WE_HIDE_INFORMATION_BAR);
|
||||
$criteria->addSelectColumn(WebEntryPeer::WE_CALLBACK);
|
||||
$criteria->addSelectColumn(WebEntryPeer::WE_CALLBACK_URL);
|
||||
$criteria->addSelectColumn(WebEntryPeer::WE_LINK_GENERATION);
|
||||
$criteria->addSelectColumn(WebEntryPeer::WE_LINK_SKIN);
|
||||
$criteria->addSelectColumn(WebEntryPeer::WE_LINK_LANGUAGE);
|
||||
$criteria->addSelectColumn(WebEntryPeer::WE_LINK_DOMAIN);
|
||||
$criteria->addSelectColumn(WebEntryPeer::TAS_UID);
|
||||
$criteria->addSelectColumn(WebEntryPeer::WE_SHOW_IN_NEW_CASE);
|
||||
$criteria->addJoin(WebEntryEventPeer::WEE_WE_UID, WebEntryPeer::WE_UID, Criteria::LEFT_JOIN);
|
||||
|
||||
return $criteria;
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -923,7 +1066,8 @@ class WebEntryEvent
|
||||
*
|
||||
* @param array $record Record
|
||||
*
|
||||
* return array Return an array with data WebEntry-Event
|
||||
* @return array Return an array with data WebEntry-Event
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getWebEntryEventDataFromRecord(array $record)
|
||||
{
|
||||
@@ -960,7 +1104,7 @@ class WebEntryEvent
|
||||
$this->getFieldNameByFormatFieldName("WE_SHOW_IN_NEW_CASE") => $record["WE_SHOW_IN_NEW_CASE"],
|
||||
$this->getFieldNameByFormatFieldName("TAS_UID") => $record["TAS_UID"],
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -970,7 +1114,8 @@ class WebEntryEvent
|
||||
*
|
||||
* @param string $projectUid Unique id of Project
|
||||
*
|
||||
* return array Return an array with all WebEntry-Events
|
||||
* @return array Return an array with all WebEntry-Events
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getWebEntryEvents($projectUid)
|
||||
{
|
||||
@@ -985,9 +1130,9 @@ class WebEntryEvent
|
||||
//Get data
|
||||
$criteria = $this->getWebEntryEventCriteria();
|
||||
|
||||
$criteria->add(\WebEntryEventPeer::PRJ_UID, $projectUid, \Criteria::EQUAL);
|
||||
$criteria->add(WebEntryEventPeer::PRJ_UID, $projectUid, Criteria::EQUAL);
|
||||
|
||||
$rsCriteria = \WebEntryEventPeer::doSelectRS($criteria);
|
||||
$rsCriteria = WebEntryEventPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($rsCriteria->next()) {
|
||||
@@ -998,7 +1143,7 @@ class WebEntryEvent
|
||||
|
||||
//Return
|
||||
return $arrayWebEntryEvent;
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -1008,7 +1153,7 @@ class WebEntryEvent
|
||||
* Return an array with all WebEntry-Events
|
||||
* @param boolean $considerShowInCase
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getAllWebEntryEvents($considerShowInCase = false)
|
||||
{
|
||||
@@ -1034,6 +1179,7 @@ class WebEntryEvent
|
||||
$row = $rsCriteria->getRow();
|
||||
$result[] = $this->getWebEntryEventDataFromRecord($row);
|
||||
}
|
||||
|
||||
return $result;
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
@@ -1046,20 +1192,22 @@ class WebEntryEvent
|
||||
* @param string $webEntryEventUid Unique id of WebEntry-Event
|
||||
* @param bool $flagGetRecord Value that set the getting
|
||||
*
|
||||
* return array Return an array with data of a WebEntry-Event
|
||||
* @return array Return an array with data of a WebEntry-Event
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getWebEntryEvent($webEntryEventUid, $flagGetRecord = false)
|
||||
{
|
||||
try {
|
||||
//Verify data
|
||||
$this->throwExceptionIfNotExistsWebEntryEvent($webEntryEventUid, $this->arrayFieldNameForException["webEntryEventUid"]);
|
||||
$this->throwExceptionIfNotExistsWebEntryEvent($webEntryEventUid,
|
||||
$this->arrayFieldNameForException["webEntryEventUid"]);
|
||||
|
||||
//Get data
|
||||
$criteria = $this->getWebEntryEventCriteria();
|
||||
|
||||
$criteria->add(\WebEntryEventPeer::WEE_UID, $webEntryEventUid, \Criteria::EQUAL);
|
||||
$criteria->add(WebEntryEventPeer::WEE_UID, $webEntryEventUid, Criteria::EQUAL);
|
||||
|
||||
$rsCriteria = \WebEntryEventPeer::doSelectRS($criteria);
|
||||
$rsCriteria = WebEntryEventPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$rsCriteria->next();
|
||||
@@ -1068,7 +1216,7 @@ class WebEntryEvent
|
||||
|
||||
//Return
|
||||
return (!$flagGetRecord) ? $this->getWebEntryEventDataFromRecord($row) : $row;
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -1080,7 +1228,8 @@ class WebEntryEvent
|
||||
* @param string $eventUid Unique id of Event
|
||||
* @param bool $flagGetRecord Value that set the getting
|
||||
*
|
||||
* return array Return an array with data of a WebEntry-Event by unique id of Event
|
||||
* @return array Return an array with data of a WebEntry-Event by unique id of Event
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getWebEntryEventByEvent($projectUid, $eventUid, $flagGetRecord = false)
|
||||
{
|
||||
@@ -1091,16 +1240,17 @@ class WebEntryEvent
|
||||
$process->throwExceptionIfNotExistsProcess($projectUid, $this->arrayFieldNameForException["projectUid"]);
|
||||
|
||||
if (!$this->existsEvent($projectUid, $eventUid)) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_WEB_ENTRY_EVENT_DOES_NOT_IS_REGISTERED", array($this->arrayFieldNameForException["eventUid"], $eventUid)));
|
||||
throw new Exception(G::LoadTranslation("ID_WEB_ENTRY_EVENT_DOES_NOT_IS_REGISTERED",
|
||||
array($this->arrayFieldNameForException["eventUid"], $eventUid)));
|
||||
}
|
||||
|
||||
//Get data
|
||||
$criteria = $this->getWebEntryEventCriteria();
|
||||
|
||||
$criteria->add(\WebEntryEventPeer::PRJ_UID, $projectUid, \Criteria::EQUAL);
|
||||
$criteria->add(\WebEntryEventPeer::EVN_UID, $eventUid, \Criteria::EQUAL);
|
||||
$criteria->add(WebEntryEventPeer::PRJ_UID, $projectUid, Criteria::EQUAL);
|
||||
$criteria->add(WebEntryEventPeer::EVN_UID, $eventUid, Criteria::EQUAL);
|
||||
|
||||
$rsCriteria = \WebEntryEventPeer::doSelectRS($criteria);
|
||||
$rsCriteria = WebEntryEventPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$rsCriteria->next();
|
||||
@@ -1109,7 +1259,7 @@ class WebEntryEvent
|
||||
|
||||
//Return
|
||||
return (!$flagGetRecord) ? $this->getWebEntryEventDataFromRecord($row) : $row;
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -1119,17 +1269,19 @@ class WebEntryEvent
|
||||
*
|
||||
* @param string $userUid uid of a user
|
||||
*
|
||||
* return integer $total
|
||||
* @return integer $total
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getWebEntryRelatedToUser($userUid)
|
||||
{
|
||||
try {
|
||||
//Get data
|
||||
$criteria = $this->getWebEntryEventCriteria();
|
||||
$criteria->add(\WebEntryEventPeer::USR_UID, $userUid, \Criteria::EQUAL);
|
||||
$total = \WebEntryEventPeer::doCount($criteria);
|
||||
$criteria->add(WebEntryEventPeer::USR_UID, $userUid, Criteria::EQUAL);
|
||||
$total = WebEntryEventPeer::doCount($criteria);
|
||||
|
||||
return $total;
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -1144,21 +1296,22 @@ class WebEntryEvent
|
||||
*/
|
||||
public function generateLink($prj_uid, $wee_uid)
|
||||
{
|
||||
$webEntryEvent = \WebEntryEventPeer::retrieveByPK($wee_uid);
|
||||
$webEntryEvent = WebEntryEventPeer::retrieveByPK($wee_uid);
|
||||
if (empty($webEntryEvent)) {
|
||||
throw new \Exception(
|
||||
\G::LoadTranslation("ID_WEB_ENTRY_EVENT_DOES_NOT_EXIST", array("WEE_UID", $wee_uid))
|
||||
throw new Exception(
|
||||
G::LoadTranslation("ID_WEB_ENTRY_EVENT_DOES_NOT_EXIST", array("WEE_UID", $wee_uid))
|
||||
);
|
||||
}
|
||||
$webEntry = \WebEntryPeer::retrieveByPK($webEntryEvent->getWeeWeUid());
|
||||
$webEntry = WebEntryPeer::retrieveByPK($webEntryEvent->getWeeWeUid());
|
||||
if (empty($webEntryEvent)) {
|
||||
throw new \Exception(
|
||||
\G::LoadTranslation(
|
||||
throw new Exception(
|
||||
G::LoadTranslation(
|
||||
"ID_WEB_ENTRY_EVENT_DOES_NOT_EXIST",
|
||||
array("WE_UID", $webEntryEvent->getWeeWeUid())
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return $this->getGeneratedLink(
|
||||
$webEntry->getWeUid(),
|
||||
$prj_uid,
|
||||
@@ -1190,7 +1343,7 @@ class WebEntryEvent
|
||||
$weLinkSkin,
|
||||
$weData
|
||||
) {
|
||||
$http = (\G::is_https()) ? "https://" : "http://";
|
||||
$http = (G::is_https()) ? "https://" : "http://";
|
||||
$port = $_SERVER['SERVER_PORT'] == '80' ? '' : ':' . $_SERVER['SERVER_PORT'];
|
||||
if ($weLinkGeneration === 'ADVANCED') {
|
||||
$domain = $weLinkDomain;
|
||||
@@ -1202,9 +1355,11 @@ class WebEntryEvent
|
||||
"/sys" . SYS_SYS . "/" .
|
||||
$weLinkLanguage . "/" .
|
||||
$weLinkSkin . "/" . $prj_uid;
|
||||
|
||||
return $url . "/" . $weData;
|
||||
} else {
|
||||
$url = $http . $_SERVER["HTTP_HOST"] . "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/" . $prj_uid;
|
||||
|
||||
return $url . "/" . $weData;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user