diff --git a/workflow/engine/classes/class.case.php b/workflow/engine/classes/class.case.php
index c73feeb49..e9e76ec53 100755
--- a/workflow/engine/classes/class.case.php
+++ b/workflow/engine/classes/class.case.php
@@ -256,6 +256,7 @@ class Cases
$c->addJoin(TaskPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN);
$c->addJoin(TaskPeer::TAS_UID, TaskUserPeer::TAS_UID, Criteria::LEFT_JOIN);
$c->add(ProcessPeer::PRO_STATUS, 'ACTIVE');
+ $c->add(TaskPeer::TAS_TYPE, "WEBENTRYEVENT", Criteria::NOT_EQUAL);
$c->add(TaskPeer::TAS_START, 'TRUE');
$c->add(TaskUserPeer::USR_UID, $sUIDUser);
@@ -281,6 +282,7 @@ class Cases
$c->addJoin(TaskPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN);
$c->addJoin(TaskPeer::TAS_UID, TaskUserPeer::TAS_UID, Criteria::LEFT_JOIN);
$c->add(ProcessPeer::PRO_STATUS, 'ACTIVE');
+ $c->add(TaskPeer::TAS_TYPE, "WEBENTRYEVENT", Criteria::NOT_EQUAL);
$c->add(TaskPeer::TAS_START, 'TRUE');
$c->add(TaskUserPeer::USR_UID, $aGroups, Criteria::IN);
@@ -3875,8 +3877,12 @@ class Cases
$oCriteria->add(AppThreadPeer::DEL_INDEX, $iDelegation);
$oDataset = AppThreadPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
- $oDataset->next();
- $aRow = $oDataset->getRow();
+
+ if ($oDataset->next()) {
+ $aRow = $oDataset->getRow();
+ } else {
+ throw new Exception(G::LoadTranslation("ID_CASE_STOPPED_TRIGGER"));
+ }
//now create a row in APP_DELAY with type PAUSE
$aData['PRO_UID'] = $aFields['PRO_UID'];
diff --git a/workflow/engine/classes/class.processes.php b/workflow/engine/classes/class.processes.php
index 435dd6fd2..b74d241af 100755
--- a/workflow/engine/classes/class.processes.php
+++ b/workflow/engine/classes/class.processes.php
@@ -851,9 +851,14 @@ class Processes
}
if (isset( $oData->steps ) && is_array( $oData->steps )) {
- foreach ($oData->steps as $key => $val) {
- $newGuid = $map[$val['TAS_UID']];
- $oData->steps[$key]['TAS_UID'] = $newGuid;
+ foreach ($oData->steps as $key => $value) {
+ $record = $value;
+
+ if (isset($map[$record["TAS_UID"]])) {
+ $newUid = $map[$record["TAS_UID"]];
+
+ $oData->steps[$key]["TAS_UID"] = $newUid;
+ }
}
}
@@ -910,6 +915,29 @@ class Processes
}
}
+ if (isset($oData->webEntry)) {
+ foreach ($oData->webEntry as $key => $value) {
+ $record = $value;
+
+ if (isset($map[$record["TAS_UID"]])) {
+ $newUid = $map[$record["TAS_UID"]];
+
+ $oData->webEntry[$key]["TAS_UID"] = $newUid;
+ }
+ }
+ }
+
+ if (isset($oData->webEntryEvent)) {
+ foreach ($oData->webEntryEvent as $key => $value) {
+ $record = $value;
+
+ if (isset($map[$record["ACT_UID"]])) {
+ $newUid = $map[$record["ACT_UID"]];
+
+ $oData->webEntryEvent[$key]["ACT_UID"] = $newUid;
+ }
+ }
+ }
}
/**
@@ -994,6 +1022,29 @@ class Processes
}
}
+ if (isset($oData->webEntry)) {
+ foreach ($oData->webEntry as $key => $value) {
+ $record = $value;
+
+ if (isset($map[$record["DYN_UID"]])) {
+ $newUid = $map[$record["DYN_UID"]];
+
+ $oData->webEntry[$key]["DYN_UID"] = $newUid;
+ }
+ }
+ }
+
+ if (isset($oData->webEntryEvent)) {
+ foreach ($oData->webEntryEvent as $key => $value) {
+ $record = $value;
+
+ if (isset($map[$record["DYN_UID"]])) {
+ $newUid = $map[$record["DYN_UID"]];
+
+ $oData->webEntryEvent[$key]["DYN_UID"] = $newUid;
+ }
+ }
+ }
}
/**
@@ -2747,6 +2798,97 @@ class Processes
}
}
+ /**
+ * Get all WebEntry records of a Process
+ *
+ * @param string $processUid Unique id of Process
+ *
+ * return array Return an array with all WebEntry records of a Process
+ */
+ public function getWebEntries($processUid)
+ {
+ try {
+ $arrayWebEntry = array();
+
+ $webEntry = new \ProcessMaker\BusinessModel\WebEntry();
+
+ //Get UIDs to exclude
+ $arrayWebEntryUidToExclude = array();
+
+ $criteria = new Criteria("workflow");
+
+ $criteria->setDistinct();
+ $criteria->addSelectColumn(WebEntryEventPeer::WEE_WE_UID);
+ $criteria->add(WebEntryEventPeer::PRJ_UID, $processUid, Criteria::EQUAL);
+
+ $rsCriteria = WebEntryEventPeer::doSelectRS($criteria);
+ $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
+
+ while ($rsCriteria->next()) {
+ $row = $rsCriteria->getRow();
+
+ $arrayWebEntryUidToExclude[] = $row["WEE_WE_UID"];
+ }
+
+ //Get data
+ $criteria = new Criteria("workflow");
+
+ $criteria->addSelectColumn(WebEntryPeer::WE_UID);
+ $criteria->add(WebEntryPeer::PRO_UID, $processUid, Criteria::EQUAL);
+ $criteria->add(WebEntryPeer::WE_UID, $arrayWebEntryUidToExclude, Criteria::NOT_IN);
+
+ $rsCriteria = WebEntryPeer::doSelectRS($criteria);
+ $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
+
+ while ($rsCriteria->next()) {
+ $row = $rsCriteria->getRow();
+
+ $arrayWebEntry[] = $webEntry->getWebEntry($row["WE_UID"], true);
+ }
+
+ //Return
+ return $arrayWebEntry;
+ } catch (Exception $e) {
+ throw $e;
+ }
+ }
+
+ /**
+ * Get all WebEntry-Event records of a Process
+ *
+ * @param string $processUid Unique id of Process
+ *
+ * return array Return an array with all WebEntry-Event records of a Process
+ */
+ public function getWebEntryEvents($processUid)
+ {
+ try {
+ $arrayWebEntryEvent = array();
+
+ $webEntryEvent = new \ProcessMaker\BusinessModel\WebEntryEvent();
+
+ //Get data
+ $criteria = new Criteria("workflow");
+
+ $criteria->addSelectColumn(WebEntryEventPeer::WEE_UID);
+ $criteria->add(WebEntryEventPeer::PRJ_UID, $processUid, Criteria::EQUAL);
+
+ $rsCriteria = WebEntryEventPeer::doSelectRS($criteria);
+ $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
+
+ while ($rsCriteria->next()) {
+ $row = $rsCriteria->getRow();
+
+ $arrayWebEntryEvent[] = $webEntryEvent->getWebEntryEvent($row["WEE_UID"], true);
+ }
+
+ //Return
+ return $arrayWebEntryEvent;
+ } catch (Exception $e) {
+ throw $e;
+ }
+ }
+
/**
* Get Task User Rows from an array of data
*
@@ -2887,6 +3029,53 @@ class Processes
}
} #@!neyek
+ /**
+ * Create WebEntry records
+ *
+ * @param string $processUid Unique id of Process
+ * @param string $userUidCreator Unique id of creator User
+ * @param array $arrayData Data
+ *
+ * return void
+ */
+ public function createWebEntry($processUid, $userUidCreator, array $arrayData)
+ {
+ try {
+ $webEntry = new \ProcessMaker\BusinessModel\WebEntry();
+
+ foreach ($arrayData as $value) {
+ $record = $value;
+
+ $arrayWebEntryData = $webEntry->create($processUid, $userUidCreator, $record);
+ }
+ } catch (Exception $e) {
+ //throw $e;
+ }
+ }
+
+ /**
+ * Create WebEntry-Event records
+ *
+ * @param string $processUid Unique id of Process
+ * @param string $userUidCreator Unique id of creator User
+ * @param array $arrayData Data
+ *
+ * return void
+ */
+ public function createWebEntryEvent($processUid, $userUidCreator, array $arrayData)
+ {
+ try {
+ $webEntryEvent = new \ProcessMaker\BusinessModel\WebEntryEvent();
+
+ foreach ($arrayData as $value) {
+ $record = $value;
+
+ $arrayWebEntryEventData = $webEntryEvent->create($processUid, $userUidCreator, $record);
+ }
+ } catch (Exception $e) {
+ //throw $e;
+ }
+ }
/**
* Cleanup Report Tables References from an array of data
@@ -3072,14 +3261,13 @@ class Processes
$oData->taskExtraProperties = $this->getTaskExtraPropertiesRows( $sProUid );
$oData->processUser = $this->getProcessUser($sProUid);
$oData->processVariables = $this->getProcessVariables($sProUid);
+ $oData->webEntry = $this->getWebEntries($sProUid);
+ $oData->webEntryEvent = $this->getWebEntryEvents($sProUid);
$oData->groupwfs = $this->groupwfsMerge($oData->groupwfs, $oData->processUser, "USR_UID");
$oData->process["PRO_TYPE_PROCESS"] = "PUBLIC";
- //krumo ($oData);die;
- //$oJSON = new Services_JSON();
- //krumo ( $oJSON->encode($oData) );
- //return $oJSON->encode($oData);
+ //Return
return $oData;
}
@@ -4077,6 +4265,8 @@ class Processes
public function createProcessPropertiesFromData ($oData)
{
+ $arrayProcessData = $oData->process;
+
// (*) Creating process dependencies
// creating the process category
$this->createProcessCategoryRow( isset( $oData->processCategory ) ? $oData->processCategory : null );
@@ -4116,7 +4306,8 @@ class Processes
$this->createProcessUser((isset($oData->processUser))? $oData->processUser : array());
$this->createProcessVariables((isset($oData->processVariables))? $oData->processVariables : array());
-
+ $this->createWebEntry($arrayProcessData["PRO_UID"], $arrayProcessData["PRO_CREATE_USER"], (isset($oData->webEntry))? $oData->webEntry : array());
+ $this->createWebEntryEvent($arrayProcessData["PRO_UID"], $arrayProcessData["PRO_CREATE_USER"], (isset($oData->webEntryEvent))? $oData->webEntryEvent : array());
}
diff --git a/workflow/engine/classes/model/WebEntryEvent.php b/workflow/engine/classes/model/WebEntryEvent.php
new file mode 100644
index 000000000..ef95c8e9c
--- /dev/null
+++ b/workflow/engine/classes/model/WebEntryEvent.php
@@ -0,0 +1,5 @@
+addColumn('TAS_SELFSERVICE_EXECUTION', 'TasSelfserviceExecution', 'string', CreoleTypes::VARCHAR, false, 15);
- $tMap->addValidator('TAS_TYPE', 'validValues', 'propel.validator.ValidValuesValidator', 'NORMAL|ADHOC|SUBPROCESS|HIDDEN|GATEWAYTOGATEWAY', 'Please enter a valid value for TAS_TYPE');
+ $tMap->addValidator('TAS_TYPE', 'validValues', 'propel.validator.ValidValuesValidator', 'NORMAL|ADHOC|SUBPROCESS|HIDDEN|GATEWAYTOGATEWAY|WEBENTRYEVENT', 'Please enter a valid value for TAS_TYPE');
$tMap->addValidator('TAS_TIMEUNIT', 'validValues', 'propel.validator.ValidValuesValidator', 'MINUTES|HOURS|DAYS|WEEKS|MONTHS', 'Please select a valid value for TAS_TIMEUNIT.');
diff --git a/workflow/engine/classes/model/map/WebEntryEventMapBuilder.php b/workflow/engine/classes/model/map/WebEntryEventMapBuilder.php
new file mode 100644
index 000000000..d5557ec8e
--- /dev/null
+++ b/workflow/engine/classes/model/map/WebEntryEventMapBuilder.php
@@ -0,0 +1,90 @@
+dbMap !== null);
+ }
+
+ /**
+ * Gets the databasemap this map builder built.
+ *
+ * @return the databasemap
+ */
+ public function getDatabaseMap()
+ {
+ return $this->dbMap;
+ }
+
+ /**
+ * The doBuild() method builds the DatabaseMap
+ *
+ * @return void
+ * @throws PropelException
+ */
+ public function doBuild()
+ {
+ $this->dbMap = Propel::getDatabaseMap('workflow');
+
+ $tMap = $this->dbMap->addTable('WEB_ENTRY_EVENT');
+ $tMap->setPhpName('WebEntryEvent');
+
+ $tMap->setUseIdGenerator(false);
+
+ $tMap->addPrimaryKey('WEE_UID', 'WeeUid', 'string', CreoleTypes::VARCHAR, true, 32);
+
+ $tMap->addColumn('PRJ_UID', 'PrjUid', 'string', CreoleTypes::VARCHAR, true, 32);
+
+ $tMap->addColumn('EVN_UID', 'EvnUid', 'string', CreoleTypes::VARCHAR, true, 32);
+
+ $tMap->addColumn('ACT_UID', 'ActUid', 'string', CreoleTypes::VARCHAR, true, 32);
+
+ $tMap->addColumn('DYN_UID', 'DynUid', 'string', CreoleTypes::VARCHAR, true, 32);
+
+ $tMap->addColumn('USR_UID', 'UsrUid', 'string', CreoleTypes::VARCHAR, true, 32);
+
+ $tMap->addColumn('WEE_STATUS', 'WeeStatus', 'string', CreoleTypes::VARCHAR, true, 10);
+
+ $tMap->addColumn('WEE_WE_UID', 'WeeWeUid', 'string', CreoleTypes::VARCHAR, true, 32);
+
+ $tMap->addColumn('WEE_WE_TAS_UID', 'WeeWeTasUid', 'string', CreoleTypes::VARCHAR, true, 32);
+
+ $tMap->addValidator('WEE_STATUS', 'validValues', 'propel.validator.ValidValuesValidator', 'ENABLED|DISABLED', 'Please enter a valid value for WEE_STATUS');
+
+ } // doBuild()
+
+} // WebEntryEventMapBuilder
diff --git a/workflow/engine/classes/model/om/BaseWebEntryEvent.php b/workflow/engine/classes/model/om/BaseWebEntryEvent.php
new file mode 100644
index 000000000..430d98199
--- /dev/null
+++ b/workflow/engine/classes/model/om/BaseWebEntryEvent.php
@@ -0,0 +1,974 @@
+wee_uid;
+ }
+
+ /**
+ * Get the [prj_uid] column value.
+ *
+ * @return string
+ */
+ public function getPrjUid()
+ {
+
+ return $this->prj_uid;
+ }
+
+ /**
+ * Get the [evn_uid] column value.
+ *
+ * @return string
+ */
+ public function getEvnUid()
+ {
+
+ return $this->evn_uid;
+ }
+
+ /**
+ * Get the [act_uid] column value.
+ *
+ * @return string
+ */
+ public function getActUid()
+ {
+
+ return $this->act_uid;
+ }
+
+ /**
+ * Get the [dyn_uid] column value.
+ *
+ * @return string
+ */
+ public function getDynUid()
+ {
+
+ return $this->dyn_uid;
+ }
+
+ /**
+ * Get the [usr_uid] column value.
+ *
+ * @return string
+ */
+ public function getUsrUid()
+ {
+
+ return $this->usr_uid;
+ }
+
+ /**
+ * Get the [wee_status] column value.
+ *
+ * @return string
+ */
+ public function getWeeStatus()
+ {
+
+ return $this->wee_status;
+ }
+
+ /**
+ * Get the [wee_we_uid] column value.
+ *
+ * @return string
+ */
+ public function getWeeWeUid()
+ {
+
+ return $this->wee_we_uid;
+ }
+
+ /**
+ * Get the [wee_we_tas_uid] column value.
+ *
+ * @return string
+ */
+ public function getWeeWeTasUid()
+ {
+
+ return $this->wee_we_tas_uid;
+ }
+
+ /**
+ * Set the value of [wee_uid] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setWeeUid($v)
+ {
+
+ // Since the native PHP type for this column is string,
+ // we will cast the input to a string (if it is not).
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->wee_uid !== $v) {
+ $this->wee_uid = $v;
+ $this->modifiedColumns[] = WebEntryEventPeer::WEE_UID;
+ }
+
+ } // setWeeUid()
+
+ /**
+ * Set the value of [prj_uid] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setPrjUid($v)
+ {
+
+ // Since the native PHP type for this column is string,
+ // we will cast the input to a string (if it is not).
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->prj_uid !== $v) {
+ $this->prj_uid = $v;
+ $this->modifiedColumns[] = WebEntryEventPeer::PRJ_UID;
+ }
+
+ } // setPrjUid()
+
+ /**
+ * Set the value of [evn_uid] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setEvnUid($v)
+ {
+
+ // Since the native PHP type for this column is string,
+ // we will cast the input to a string (if it is not).
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->evn_uid !== $v) {
+ $this->evn_uid = $v;
+ $this->modifiedColumns[] = WebEntryEventPeer::EVN_UID;
+ }
+
+ } // setEvnUid()
+
+ /**
+ * Set the value of [act_uid] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setActUid($v)
+ {
+
+ // Since the native PHP type for this column is string,
+ // we will cast the input to a string (if it is not).
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->act_uid !== $v) {
+ $this->act_uid = $v;
+ $this->modifiedColumns[] = WebEntryEventPeer::ACT_UID;
+ }
+
+ } // setActUid()
+
+ /**
+ * Set the value of [dyn_uid] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setDynUid($v)
+ {
+
+ // Since the native PHP type for this column is string,
+ // we will cast the input to a string (if it is not).
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->dyn_uid !== $v) {
+ $this->dyn_uid = $v;
+ $this->modifiedColumns[] = WebEntryEventPeer::DYN_UID;
+ }
+
+ } // setDynUid()
+
+ /**
+ * Set the value of [usr_uid] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setUsrUid($v)
+ {
+
+ // Since the native PHP type for this column is string,
+ // we will cast the input to a string (if it is not).
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->usr_uid !== $v) {
+ $this->usr_uid = $v;
+ $this->modifiedColumns[] = WebEntryEventPeer::USR_UID;
+ }
+
+ } // setUsrUid()
+
+ /**
+ * Set the value of [wee_status] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setWeeStatus($v)
+ {
+
+ // Since the native PHP type for this column is string,
+ // we will cast the input to a string (if it is not).
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->wee_status !== $v || $v === 'ENABLED') {
+ $this->wee_status = $v;
+ $this->modifiedColumns[] = WebEntryEventPeer::WEE_STATUS;
+ }
+
+ } // setWeeStatus()
+
+ /**
+ * Set the value of [wee_we_uid] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setWeeWeUid($v)
+ {
+
+ // Since the native PHP type for this column is string,
+ // we will cast the input to a string (if it is not).
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->wee_we_uid !== $v || $v === '') {
+ $this->wee_we_uid = $v;
+ $this->modifiedColumns[] = WebEntryEventPeer::WEE_WE_UID;
+ }
+
+ } // setWeeWeUid()
+
+ /**
+ * Set the value of [wee_we_tas_uid] column.
+ *
+ * @param string $v new value
+ * @return void
+ */
+ public function setWeeWeTasUid($v)
+ {
+
+ // Since the native PHP type for this column is string,
+ // we will cast the input to a string (if it is not).
+ if ($v !== null && !is_string($v)) {
+ $v = (string) $v;
+ }
+
+ if ($this->wee_we_tas_uid !== $v || $v === '') {
+ $this->wee_we_tas_uid = $v;
+ $this->modifiedColumns[] = WebEntryEventPeer::WEE_WE_TAS_UID;
+ }
+
+ } // setWeeWeTasUid()
+
+ /**
+ * Hydrates (populates) the object variables with values from the database resultset.
+ *
+ * An offset (1-based "start column") is specified so that objects can be hydrated
+ * with a subset of the columns in the resultset rows. This is needed, for example,
+ * for results of JOIN queries where the resultset row includes columns from two or
+ * more tables.
+ *
+ * @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos.
+ * @param int $startcol 1-based offset column which indicates which restultset column to start with.
+ * @return int next starting column
+ * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
+ */
+ public function hydrate(ResultSet $rs, $startcol = 1)
+ {
+ try {
+
+ $this->wee_uid = $rs->getString($startcol + 0);
+
+ $this->prj_uid = $rs->getString($startcol + 1);
+
+ $this->evn_uid = $rs->getString($startcol + 2);
+
+ $this->act_uid = $rs->getString($startcol + 3);
+
+ $this->dyn_uid = $rs->getString($startcol + 4);
+
+ $this->usr_uid = $rs->getString($startcol + 5);
+
+ $this->wee_status = $rs->getString($startcol + 6);
+
+ $this->wee_we_uid = $rs->getString($startcol + 7);
+
+ $this->wee_we_tas_uid = $rs->getString($startcol + 8);
+
+ $this->resetModified();
+
+ $this->setNew(false);
+
+ // FIXME - using NUM_COLUMNS may be clearer.
+ return $startcol + 9; // 9 = WebEntryEventPeer::NUM_COLUMNS - WebEntryEventPeer::NUM_LAZY_LOAD_COLUMNS).
+
+ } catch (Exception $e) {
+ throw new PropelException("Error populating WebEntryEvent object", $e);
+ }
+ }
+
+ /**
+ * Removes this object from datastore and sets delete attribute.
+ *
+ * @param Connection $con
+ * @return void
+ * @throws PropelException
+ * @see BaseObject::setDeleted()
+ * @see BaseObject::isDeleted()
+ */
+ public function delete($con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("This object has already been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(WebEntryEventPeer::DATABASE_NAME);
+ }
+
+ try {
+ $con->begin();
+ WebEntryEventPeer::doDelete($this, $con);
+ $this->setDeleted(true);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+ /**
+ * Stores the object in the database. If the object is new,
+ * it inserts it; otherwise an update is performed. This method
+ * wraps the doSave() worker method in a transaction.
+ *
+ * @param Connection $con
+ * @return int The number of rows affected by this insert/update
+ * @throws PropelException
+ * @see doSave()
+ */
+ public function save($con = null)
+ {
+ if ($this->isDeleted()) {
+ throw new PropelException("You cannot save an object that has been deleted.");
+ }
+
+ if ($con === null) {
+ $con = Propel::getConnection(WebEntryEventPeer::DATABASE_NAME);
+ }
+
+ try {
+ $con->begin();
+ $affectedRows = $this->doSave($con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+ /**
+ * Stores the object in the database.
+ *
+ * If the object is new, it inserts it; otherwise an update is performed.
+ * All related objects are also updated in this method.
+ *
+ * @param Connection $con
+ * @return int The number of rows affected by this insert/update and any referring
+ * @throws PropelException
+ * @see save()
+ */
+ protected function doSave($con)
+ {
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ if (!$this->alreadyInSave) {
+ $this->alreadyInSave = true;
+
+
+ // If this object has been modified, then save it to the database.
+ if ($this->isModified()) {
+ if ($this->isNew()) {
+ $pk = WebEntryEventPeer::doInsert($this, $con);
+ $affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which
+ // should always be true here (even though technically
+ // BasePeer::doInsert() can insert multiple rows).
+
+ $this->setNew(false);
+ } else {
+ $affectedRows += WebEntryEventPeer::doUpdate($this, $con);
+ }
+ $this->resetModified(); // [HL] After being saved an object is no longer 'modified'
+ }
+
+ $this->alreadyInSave = false;
+ }
+ return $affectedRows;
+ } // doSave()
+
+ /**
+ * Array of ValidationFailed objects.
+ * @var array ValidationFailed[]
+ */
+ protected $validationFailures = array();
+
+ /**
+ * Gets any ValidationFailed objects that resulted from last call to validate().
+ *
+ *
+ * @return array ValidationFailed[]
+ * @see validate()
+ */
+ public function getValidationFailures()
+ {
+ return $this->validationFailures;
+ }
+
+ /**
+ * Validates the objects modified field values and all objects related to this table.
+ *
+ * If $columns is either a column name or an array of column names
+ * only those columns are validated.
+ *
+ * @param mixed $columns Column name or an array of column names.
+ * @return boolean Whether all columns pass validation.
+ * @see doValidate()
+ * @see getValidationFailures()
+ */
+ public function validate($columns = null)
+ {
+ $res = $this->doValidate($columns);
+ if ($res === true) {
+ $this->validationFailures = array();
+ return true;
+ } else {
+ $this->validationFailures = $res;
+ return false;
+ }
+ }
+
+ /**
+ * This function performs the validation work for complex object models.
+ *
+ * In addition to checking the current object, all related objects will
+ * also be validated. If all pass then true is returned; otherwise
+ * an aggreagated array of ValidationFailed objects will be returned.
+ *
+ * @param array $columns Array of column names to validate.
+ * @return mixed true if all validations pass;
+ array of ValidationFailed objects otherwise.
+ */
+ protected function doValidate($columns = null)
+ {
+ if (!$this->alreadyInValidation) {
+ $this->alreadyInValidation = true;
+ $retval = null;
+
+ $failureMap = array();
+
+
+ if (($retval = WebEntryEventPeer::doValidate($this, $columns)) !== true) {
+ $failureMap = array_merge($failureMap, $retval);
+ }
+
+
+
+ $this->alreadyInValidation = false;
+ }
+
+ return (!empty($failureMap) ? $failureMap : true);
+ }
+
+ /**
+ * Retrieves a field from the object by name passed in as a string.
+ *
+ * @param string $name name
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants TYPE_PHPNAME,
+ * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
+ * @return mixed Value of field.
+ */
+ public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = WebEntryEventPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ return $this->getByPosition($pos);
+ }
+
+ /**
+ * Retrieves a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @return mixed Value of field at $pos
+ */
+ public function getByPosition($pos)
+ {
+ switch($pos) {
+ case 0:
+ return $this->getWeeUid();
+ break;
+ case 1:
+ return $this->getPrjUid();
+ break;
+ case 2:
+ return $this->getEvnUid();
+ break;
+ case 3:
+ return $this->getActUid();
+ break;
+ case 4:
+ return $this->getDynUid();
+ break;
+ case 5:
+ return $this->getUsrUid();
+ break;
+ case 6:
+ return $this->getWeeStatus();
+ break;
+ case 7:
+ return $this->getWeeWeUid();
+ break;
+ case 8:
+ return $this->getWeeWeTasUid();
+ break;
+ default:
+ return null;
+ break;
+ } // switch()
+ }
+
+ /**
+ * Exports the object as an array.
+ *
+ * You can specify the key type of the array by passing one of the class
+ * type constants.
+ *
+ * @param string $keyType One of the class type constants TYPE_PHPNAME,
+ * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
+ * @return an associative array containing the field names (as keys) and field values
+ */
+ public function toArray($keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = WebEntryEventPeer::getFieldNames($keyType);
+ $result = array(
+ $keys[0] => $this->getWeeUid(),
+ $keys[1] => $this->getPrjUid(),
+ $keys[2] => $this->getEvnUid(),
+ $keys[3] => $this->getActUid(),
+ $keys[4] => $this->getDynUid(),
+ $keys[5] => $this->getUsrUid(),
+ $keys[6] => $this->getWeeStatus(),
+ $keys[7] => $this->getWeeWeUid(),
+ $keys[8] => $this->getWeeWeTasUid(),
+ );
+ return $result;
+ }
+
+ /**
+ * Sets a field from the object by name passed in as a string.
+ *
+ * @param string $name peer name
+ * @param mixed $value field value
+ * @param string $type The type of fieldname the $name is of:
+ * one of the class type constants TYPE_PHPNAME,
+ * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
+ * @return void
+ */
+ public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
+ {
+ $pos = WebEntryEventPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
+ return $this->setByPosition($pos, $value);
+ }
+
+ /**
+ * Sets a field from the object by Position as specified in the xml schema.
+ * Zero-based.
+ *
+ * @param int $pos position in xml schema
+ * @param mixed $value field value
+ * @return void
+ */
+ public function setByPosition($pos, $value)
+ {
+ switch($pos) {
+ case 0:
+ $this->setWeeUid($value);
+ break;
+ case 1:
+ $this->setPrjUid($value);
+ break;
+ case 2:
+ $this->setEvnUid($value);
+ break;
+ case 3:
+ $this->setActUid($value);
+ break;
+ case 4:
+ $this->setDynUid($value);
+ break;
+ case 5:
+ $this->setUsrUid($value);
+ break;
+ case 6:
+ $this->setWeeStatus($value);
+ break;
+ case 7:
+ $this->setWeeWeUid($value);
+ break;
+ case 8:
+ $this->setWeeWeTasUid($value);
+ break;
+ } // switch()
+ }
+
+ /**
+ * Populates the object using an array.
+ *
+ * This is particularly useful when populating an object from one of the
+ * request arrays (e.g. $_POST). This method goes through the column
+ * names, checking to see whether a matching key exists in populated
+ * array. If so the setByName() method is called for that column.
+ *
+ * You can specify the key type of the array by additionally passing one
+ * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME,
+ * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId')
+ *
+ * @param array $arr An array to populate the object from.
+ * @param string $keyType The type of keys the array uses.
+ * @return void
+ */
+ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
+ {
+ $keys = WebEntryEventPeer::getFieldNames($keyType);
+
+ if (array_key_exists($keys[0], $arr)) {
+ $this->setWeeUid($arr[$keys[0]]);
+ }
+
+ if (array_key_exists($keys[1], $arr)) {
+ $this->setPrjUid($arr[$keys[1]]);
+ }
+
+ if (array_key_exists($keys[2], $arr)) {
+ $this->setEvnUid($arr[$keys[2]]);
+ }
+
+ if (array_key_exists($keys[3], $arr)) {
+ $this->setActUid($arr[$keys[3]]);
+ }
+
+ if (array_key_exists($keys[4], $arr)) {
+ $this->setDynUid($arr[$keys[4]]);
+ }
+
+ if (array_key_exists($keys[5], $arr)) {
+ $this->setUsrUid($arr[$keys[5]]);
+ }
+
+ if (array_key_exists($keys[6], $arr)) {
+ $this->setWeeStatus($arr[$keys[6]]);
+ }
+
+ if (array_key_exists($keys[7], $arr)) {
+ $this->setWeeWeUid($arr[$keys[7]]);
+ }
+
+ if (array_key_exists($keys[8], $arr)) {
+ $this->setWeeWeTasUid($arr[$keys[8]]);
+ }
+
+ }
+
+ /**
+ * Build a Criteria object containing the values of all modified columns in this object.
+ *
+ * @return Criteria The Criteria object containing all modified values.
+ */
+ public function buildCriteria()
+ {
+ $criteria = new Criteria(WebEntryEventPeer::DATABASE_NAME);
+
+ if ($this->isColumnModified(WebEntryEventPeer::WEE_UID)) {
+ $criteria->add(WebEntryEventPeer::WEE_UID, $this->wee_uid);
+ }
+
+ if ($this->isColumnModified(WebEntryEventPeer::PRJ_UID)) {
+ $criteria->add(WebEntryEventPeer::PRJ_UID, $this->prj_uid);
+ }
+
+ if ($this->isColumnModified(WebEntryEventPeer::EVN_UID)) {
+ $criteria->add(WebEntryEventPeer::EVN_UID, $this->evn_uid);
+ }
+
+ if ($this->isColumnModified(WebEntryEventPeer::ACT_UID)) {
+ $criteria->add(WebEntryEventPeer::ACT_UID, $this->act_uid);
+ }
+
+ if ($this->isColumnModified(WebEntryEventPeer::DYN_UID)) {
+ $criteria->add(WebEntryEventPeer::DYN_UID, $this->dyn_uid);
+ }
+
+ if ($this->isColumnModified(WebEntryEventPeer::USR_UID)) {
+ $criteria->add(WebEntryEventPeer::USR_UID, $this->usr_uid);
+ }
+
+ if ($this->isColumnModified(WebEntryEventPeer::WEE_STATUS)) {
+ $criteria->add(WebEntryEventPeer::WEE_STATUS, $this->wee_status);
+ }
+
+ if ($this->isColumnModified(WebEntryEventPeer::WEE_WE_UID)) {
+ $criteria->add(WebEntryEventPeer::WEE_WE_UID, $this->wee_we_uid);
+ }
+
+ if ($this->isColumnModified(WebEntryEventPeer::WEE_WE_TAS_UID)) {
+ $criteria->add(WebEntryEventPeer::WEE_WE_TAS_UID, $this->wee_we_tas_uid);
+ }
+
+
+ return $criteria;
+ }
+
+ /**
+ * Builds a Criteria object containing the primary key for this object.
+ *
+ * Unlike buildCriteria() this method includes the primary key values regardless
+ * of whether or not they have been modified.
+ *
+ * @return Criteria The Criteria object containing value(s) for primary key(s).
+ */
+ public function buildPkeyCriteria()
+ {
+ $criteria = new Criteria(WebEntryEventPeer::DATABASE_NAME);
+
+ $criteria->add(WebEntryEventPeer::WEE_UID, $this->wee_uid);
+
+ return $criteria;
+ }
+
+ /**
+ * Returns the primary key for this object (row).
+ * @return string
+ */
+ public function getPrimaryKey()
+ {
+ return $this->getWeeUid();
+ }
+
+ /**
+ * Generic method to set the primary key (wee_uid column).
+ *
+ * @param string $key Primary key.
+ * @return void
+ */
+ public function setPrimaryKey($key)
+ {
+ $this->setWeeUid($key);
+ }
+
+ /**
+ * Sets contents of passed object to values from current object.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param object $copyObj An object of WebEntryEvent (or compatible) type.
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @throws PropelException
+ */
+ public function copyInto($copyObj, $deepCopy = false)
+ {
+
+ $copyObj->setPrjUid($this->prj_uid);
+
+ $copyObj->setEvnUid($this->evn_uid);
+
+ $copyObj->setActUid($this->act_uid);
+
+ $copyObj->setDynUid($this->dyn_uid);
+
+ $copyObj->setUsrUid($this->usr_uid);
+
+ $copyObj->setWeeStatus($this->wee_status);
+
+ $copyObj->setWeeWeUid($this->wee_we_uid);
+
+ $copyObj->setWeeWeTasUid($this->wee_we_tas_uid);
+
+
+ $copyObj->setNew(true);
+
+ $copyObj->setWeeUid(NULL); // this is a pkey column, so set to default value
+
+ }
+
+ /**
+ * Makes a copy of this object that will be inserted as a new row in table when saved.
+ * It creates a new object filling in the simple attributes, but skipping any primary
+ * keys that are defined for the table.
+ *
+ * If desired, this method can also make copies of all associated (fkey referrers)
+ * objects.
+ *
+ * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
+ * @return WebEntryEvent Clone of current object.
+ * @throws PropelException
+ */
+ public function copy($deepCopy = false)
+ {
+ // we use get_class(), because this might be a subclass
+ $clazz = get_class($this);
+ $copyObj = new $clazz();
+ $this->copyInto($copyObj, $deepCopy);
+ return $copyObj;
+ }
+
+ /**
+ * Returns a peer instance associated with this om.
+ *
+ * Since Peer classes are not to have any instance attributes, this method returns the
+ * same instance for all member of this class. The method could therefore
+ * be static, but this would prevent one from overriding the behavior.
+ *
+ * @return WebEntryEventPeer
+ */
+ public function getPeer()
+ {
+ if (self::$peer === null) {
+ self::$peer = new WebEntryEventPeer();
+ }
+ return self::$peer;
+ }
+}
+
diff --git a/workflow/engine/classes/model/om/BaseWebEntryEventPeer.php b/workflow/engine/classes/model/om/BaseWebEntryEventPeer.php
new file mode 100644
index 000000000..10447b742
--- /dev/null
+++ b/workflow/engine/classes/model/om/BaseWebEntryEventPeer.php
@@ -0,0 +1,610 @@
+ array ('WeeUid', 'PrjUid', 'EvnUid', 'ActUid', 'DynUid', 'UsrUid', 'WeeStatus', 'WeeWeUid', 'WeeWeTasUid', ),
+ BasePeer::TYPE_COLNAME => array (WebEntryEventPeer::WEE_UID, WebEntryEventPeer::PRJ_UID, WebEntryEventPeer::EVN_UID, WebEntryEventPeer::ACT_UID, WebEntryEventPeer::DYN_UID, WebEntryEventPeer::USR_UID, WebEntryEventPeer::WEE_STATUS, WebEntryEventPeer::WEE_WE_UID, WebEntryEventPeer::WEE_WE_TAS_UID, ),
+ BasePeer::TYPE_FIELDNAME => array ('WEE_UID', 'PRJ_UID', 'EVN_UID', 'ACT_UID', 'DYN_UID', 'USR_UID', 'WEE_STATUS', 'WEE_WE_UID', 'WEE_WE_TAS_UID', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, )
+ );
+
+ /**
+ * holds an array of keys for quick access to the fieldnames array
+ *
+ * first dimension keys are the type constants
+ * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
+ */
+ private static $fieldKeys = array (
+ BasePeer::TYPE_PHPNAME => array ('WeeUid' => 0, 'PrjUid' => 1, 'EvnUid' => 2, 'ActUid' => 3, 'DynUid' => 4, 'UsrUid' => 5, 'WeeStatus' => 6, 'WeeWeUid' => 7, 'WeeWeTasUid' => 8, ),
+ BasePeer::TYPE_COLNAME => array (WebEntryEventPeer::WEE_UID => 0, WebEntryEventPeer::PRJ_UID => 1, WebEntryEventPeer::EVN_UID => 2, WebEntryEventPeer::ACT_UID => 3, WebEntryEventPeer::DYN_UID => 4, WebEntryEventPeer::USR_UID => 5, WebEntryEventPeer::WEE_STATUS => 6, WebEntryEventPeer::WEE_WE_UID => 7, WebEntryEventPeer::WEE_WE_TAS_UID => 8, ),
+ BasePeer::TYPE_FIELDNAME => array ('WEE_UID' => 0, 'PRJ_UID' => 1, 'EVN_UID' => 2, 'ACT_UID' => 3, 'DYN_UID' => 4, 'USR_UID' => 5, 'WEE_STATUS' => 6, 'WEE_WE_UID' => 7, 'WEE_WE_TAS_UID' => 8, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, )
+ );
+
+ /**
+ * @return MapBuilder the map builder for this peer
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getMapBuilder()
+ {
+ include_once 'classes/model/map/WebEntryEventMapBuilder.php';
+ return BasePeer::getMapBuilder('classes.model.map.WebEntryEventMapBuilder');
+ }
+ /**
+ * Gets a map (hash) of PHP names to DB column names.
+ *
+ * @return array The PHP to DB name map for this peer
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this.
+ */
+ public static function getPhpNameMap()
+ {
+ if (self::$phpNameMap === null) {
+ $map = WebEntryEventPeer::getTableMap();
+ $columns = $map->getColumns();
+ $nameMap = array();
+ foreach ($columns as $column) {
+ $nameMap[$column->getPhpName()] = $column->getColumnName();
+ }
+ self::$phpNameMap = $nameMap;
+ }
+ return self::$phpNameMap;
+ }
+ /**
+ * Translates a fieldname to another type
+ *
+ * @param string $name field name
+ * @param string $fromType One of the class type constants TYPE_PHPNAME,
+ * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
+ * @param string $toType One of the class type constants
+ * @return string translated name of the field.
+ */
+ static public function translateFieldName($name, $fromType, $toType)
+ {
+ $toNames = self::getFieldNames($toType);
+ $key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
+ if ($key === null) {
+ throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
+ }
+ return $toNames[$key];
+ }
+
+ /**
+ * Returns an array of of field names.
+ *
+ * @param string $type The type of fieldnames to return:
+ * One of the class type constants TYPE_PHPNAME,
+ * TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
+ * @return array A list of field names
+ */
+
+ static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
+ {
+ if (!array_key_exists($type, self::$fieldNames)) {
+ throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
+ }
+ return self::$fieldNames[$type];
+ }
+
+ /**
+ * Convenience method which changes table.column to alias.column.
+ *
+ * Using this method you can maintain SQL abstraction while using column aliases.
+ *
+ * $c->addAlias("alias1", TablePeer::TABLE_NAME);
+ * $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
+ *
+ * @param string $alias The alias for the current table.
+ * @param string $column The column name for current table. (i.e. WebEntryEventPeer::COLUMN_NAME).
+ * @return string
+ */
+ public static function alias($alias, $column)
+ {
+ return str_replace(WebEntryEventPeer::TABLE_NAME.'.', $alias.'.', $column);
+ }
+
+ /**
+ * Add all the columns needed to create a new object.
+ *
+ * Note: any columns that were marked with lazyLoad="true" in the
+ * XML schema will not be added to the select list and only loaded
+ * on demand.
+ *
+ * @param criteria object containing the columns to add.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function addSelectColumns(Criteria $criteria)
+ {
+
+ $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_STATUS);
+
+ $criteria->addSelectColumn(WebEntryEventPeer::WEE_WE_UID);
+
+ $criteria->addSelectColumn(WebEntryEventPeer::WEE_WE_TAS_UID);
+
+ }
+
+ const COUNT = 'COUNT(WEB_ENTRY_EVENT.WEE_UID)';
+ const COUNT_DISTINCT = 'COUNT(DISTINCT WEB_ENTRY_EVENT.WEE_UID)';
+
+ /**
+ * Returns the number of rows matching criteria.
+ *
+ * @param Criteria $criteria
+ * @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
+ * @param Connection $con
+ * @return int Number of matching rows.
+ */
+ public static function doCount(Criteria $criteria, $distinct = false, $con = null)
+ {
+ // we're going to modify criteria, so copy it first
+ $criteria = clone $criteria;
+
+ // clear out anything that might confuse the ORDER BY clause
+ $criteria->clearSelectColumns()->clearOrderByColumns();
+ if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
+ $criteria->addSelectColumn(WebEntryEventPeer::COUNT_DISTINCT);
+ } else {
+ $criteria->addSelectColumn(WebEntryEventPeer::COUNT);
+ }
+
+ // just in case we're grouping: add those columns to the select statement
+ foreach ($criteria->getGroupByColumns() as $column) {
+ $criteria->addSelectColumn($column);
+ }
+
+ $rs = WebEntryEventPeer::doSelectRS($criteria, $con);
+ if ($rs->next()) {
+ return $rs->getInt(1);
+ } else {
+ // no rows returned; we infer that means 0 matches.
+ return 0;
+ }
+ }
+ /**
+ * Method to select one object from the DB.
+ *
+ * @param Criteria $criteria object used to create the SELECT statement.
+ * @param Connection $con
+ * @return WebEntryEvent
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelectOne(Criteria $criteria, $con = null)
+ {
+ $critcopy = clone $criteria;
+ $critcopy->setLimit(1);
+ $objects = WebEntryEventPeer::doSelect($critcopy, $con);
+ if ($objects) {
+ return $objects[0];
+ }
+ return null;
+ }
+ /**
+ * Method to do selects.
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param Connection $con
+ * @return array Array of selected Objects
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doSelect(Criteria $criteria, $con = null)
+ {
+ return WebEntryEventPeer::populateObjects(WebEntryEventPeer::doSelectRS($criteria, $con));
+ }
+ /**
+ * Prepares the Criteria object and uses the parent doSelect()
+ * method to get a ResultSet.
+ *
+ * Use this method directly if you want to just get the resultset
+ * (instead of an array of objects).
+ *
+ * @param Criteria $criteria The Criteria object used to build the SELECT statement.
+ * @param Connection $con the connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ * @return ResultSet The resultset object with numerically-indexed fields.
+ * @see BasePeer::doSelect()
+ */
+ public static function doSelectRS(Criteria $criteria, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ if (!$criteria->getSelectColumns()) {
+ $criteria = clone $criteria;
+ WebEntryEventPeer::addSelectColumns($criteria);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ // BasePeer returns a Creole ResultSet, set to return
+ // rows indexed numerically.
+ return BasePeer::doSelect($criteria, $con);
+ }
+ /**
+ * The returned array will contain objects of the default type or
+ * objects that inherit from the default.
+ *
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function populateObjects(ResultSet $rs)
+ {
+ $results = array();
+
+ // set the class once to avoid overhead in the loop
+ $cls = WebEntryEventPeer::getOMClass();
+ $cls = Propel::import($cls);
+ // populate the object(s)
+ while ($rs->next()) {
+
+ $obj = new $cls();
+ $obj->hydrate($rs);
+ $results[] = $obj;
+
+ }
+ return $results;
+ }
+ /**
+ * Returns the TableMap related to this peer.
+ * This method is not needed for general use but a specific application could have a need.
+ * @return TableMap
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function getTableMap()
+ {
+ return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
+ }
+
+ /**
+ * The class that the Peer will make instances of.
+ *
+ * This uses a dot-path notation which is tranalted into a path
+ * relative to a location on the PHP include_path.
+ * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
+ *
+ * @return string path.to.ClassName
+ */
+ public static function getOMClass()
+ {
+ return WebEntryEventPeer::CLASS_DEFAULT;
+ }
+
+ /**
+ * Method perform an INSERT on the database, given a WebEntryEvent or Criteria object.
+ *
+ * @param mixed $values Criteria or WebEntryEvent object containing data that is used to create the INSERT statement.
+ * @param Connection $con the connection to use
+ * @return mixed The new primary key.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doInsert($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } else {
+ $criteria = $values->buildCriteria(); // build Criteria from WebEntryEvent object
+ }
+
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table (I guess, conceivably)
+ $con->begin();
+ $pk = BasePeer::doInsert($criteria, $con);
+ $con->commit();
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+
+ return $pk;
+ }
+
+ /**
+ * Method perform an UPDATE on the database, given a WebEntryEvent or Criteria object.
+ *
+ * @param mixed $values Criteria or WebEntryEvent object containing data create the UPDATE statement.
+ * @param Connection $con The connection to use (specify Connection exert more control over transactions).
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doUpdate($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $selectCriteria = new Criteria(self::DATABASE_NAME);
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+
+ $comparison = $criteria->getComparison(WebEntryEventPeer::WEE_UID);
+ $selectCriteria->add(WebEntryEventPeer::WEE_UID, $criteria->remove(WebEntryEventPeer::WEE_UID), $comparison);
+
+ } else {
+ $criteria = $values->buildCriteria(); // gets full criteria
+ $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
+ }
+
+ // set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ return BasePeer::doUpdate($selectCriteria, $criteria, $con);
+ }
+
+ /**
+ * Method to DELETE all rows from the WEB_ENTRY_EVENT table.
+ *
+ * @return int The number of affected rows (if supported by underlying database driver).
+ */
+ public static function doDeleteAll($con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+ $affectedRows = 0; // initialize var to track total num of affected rows
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->begin();
+ $affectedRows += BasePeer::doDeleteAll(WebEntryEventPeer::TABLE_NAME, $con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+ /**
+ * Method perform a DELETE on the database, given a WebEntryEvent or Criteria object OR a primary key value.
+ *
+ * @param mixed $values Criteria or WebEntryEvent object or primary key or array of primary keys
+ * which is used to create the DELETE statement
+ * @param Connection $con the connection to use
+ * @return int The number of affected rows (if supported by underlying database driver).
+ * This includes CASCADE-related rows
+ * if supported by native driver or if emulated using Propel.
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function doDelete($values, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(WebEntryEventPeer::DATABASE_NAME);
+ }
+
+ if ($values instanceof Criteria) {
+ $criteria = clone $values; // rename for clarity
+ } elseif ($values instanceof WebEntryEvent) {
+
+ $criteria = $values->buildPkeyCriteria();
+ } else {
+ // it must be the primary key
+ $criteria = new Criteria(self::DATABASE_NAME);
+ $criteria->add(WebEntryEventPeer::WEE_UID, (array) $values, Criteria::IN);
+ }
+
+ // Set the correct dbName
+ $criteria->setDbName(self::DATABASE_NAME);
+
+ $affectedRows = 0; // initialize var to track total num of affected rows
+
+ try {
+ // use transaction because $criteria could contain info
+ // for more than one table or we could emulating ON DELETE CASCADE, etc.
+ $con->begin();
+
+ $affectedRows += BasePeer::doDelete($criteria, $con);
+ $con->commit();
+ return $affectedRows;
+ } catch (PropelException $e) {
+ $con->rollback();
+ throw $e;
+ }
+ }
+
+ /**
+ * Validates all modified columns of given WebEntryEvent object.
+ * If parameter $columns is either a single column name or an array of column names
+ * than only those columns are validated.
+ *
+ * NOTICE: This does not apply to primary or foreign keys for now.
+ *
+ * @param WebEntryEvent $obj The object to validate.
+ * @param mixed $cols Column name or array of column names.
+ *
+ * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
+ */
+ public static function doValidate(WebEntryEvent $obj, $cols = null)
+ {
+ $columns = array();
+
+ if ($cols) {
+ $dbMap = Propel::getDatabaseMap(WebEntryEventPeer::DATABASE_NAME);
+ $tableMap = $dbMap->getTable(WebEntryEventPeer::TABLE_NAME);
+
+ if (! is_array($cols)) {
+ $cols = array($cols);
+ }
+
+ foreach ($cols as $colName) {
+ if ($tableMap->containsColumn($colName)) {
+ $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
+ $columns[$colName] = $obj->$get();
+ }
+ }
+ } else {
+
+ if ($obj->isNew() || $obj->isColumnModified(WebEntryEventPeer::WEE_STATUS))
+ $columns[WebEntryEventPeer::WEE_STATUS] = $obj->getWeeStatus();
+
+ }
+
+ return BasePeer::doValidate(WebEntryEventPeer::DATABASE_NAME, WebEntryEventPeer::TABLE_NAME, $columns);
+ }
+
+ /**
+ * Retrieve a single object by pkey.
+ *
+ * @param mixed $pk the primary key.
+ * @param Connection $con the connection to use
+ * @return WebEntryEvent
+ */
+ public static function retrieveByPK($pk, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $criteria = new Criteria(WebEntryEventPeer::DATABASE_NAME);
+
+ $criteria->add(WebEntryEventPeer::WEE_UID, $pk);
+
+
+ $v = WebEntryEventPeer::doSelect($criteria, $con);
+
+ return !empty($v) > 0 ? $v[0] : null;
+ }
+
+ /**
+ * Retrieve multiple objects by pkey.
+ *
+ * @param array $pks List of primary keys
+ * @param Connection $con the connection to use
+ * @throws PropelException Any exceptions caught during processing will be
+ * rethrown wrapped into a PropelException.
+ */
+ public static function retrieveByPKs($pks, $con = null)
+ {
+ if ($con === null) {
+ $con = Propel::getConnection(self::DATABASE_NAME);
+ }
+
+ $objs = null;
+ if (empty($pks)) {
+ $objs = array();
+ } else {
+ $criteria = new Criteria();
+ $criteria->add(WebEntryEventPeer::WEE_UID, $pks, Criteria::IN);
+ $objs = WebEntryEventPeer::doSelect($criteria, $con);
+ }
+ return $objs;
+ }
+}
+
+
+// static code to register the map builder for this Peer with the main Propel class
+if (Propel::isInit()) {
+ // the MapBuilder classes register themselves with Propel during initialization
+ // so we need to load them here.
+ try {
+ BaseWebEntryEventPeer::getMapBuilder();
+ } catch (Exception $e) {
+ Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
+ }
+} else {
+ // even if Propel is not yet initialized, the map builder class can be registered
+ // now and then it will be loaded when Propel initializes.
+ require_once 'classes/model/map/WebEntryEventMapBuilder.php';
+ Propel::registerMapBuilder('classes.model.map.WebEntryEventMapBuilder');
+}
+
diff --git a/workflow/engine/config/schema.xml b/workflow/engine/config/schema.xml
index 4faf9f7ec..bf077b4ff 100755
--- a/workflow/engine/config/schema.xml
+++ b/workflow/engine/config/schema.xml
@@ -1248,7 +1248,7 @@
-
+
@@ -4209,5 +4209,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/workflow/engine/data/mssql/schema.sql b/workflow/engine/data/mssql/schema.sql
index 669421f6b..ae8cd4aba 100755
--- a/workflow/engine/data/mssql/schema.sql
+++ b/workflow/engine/data/mssql/schema.sql
@@ -3356,4 +3356,49 @@ CREATE TABLE [MESSAGE_DETAIL]
[MD_TYPE] VARCHAR(32) default '' NULL,
[MD_NAME] VARCHAR(255) default '' NULL,
CONSTRAINT MESSAGE_DETAIL_PK PRIMARY KEY ([MD_UID])
-);
\ No newline at end of file
+);
+
+/* --------------------------------------------------------------------------- */
+/* WEB_ENTRY_EVENT */
+/* --------------------------------------------------------------------------- */
+
+IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'WEB_ENTRY_EVENT')
+BEGIN
+ DECLARE @reftable_72 nvarchar(60), @constraintname_72 nvarchar(60)
+ DECLARE refcursor CURSOR FOR
+ select reftables.name tablename, cons.name constraintname
+ from sysobjects tables,
+ sysobjects reftables,
+ sysobjects cons,
+ sysreferences ref
+ where tables.id = ref.rkeyid
+ and cons.id = ref.constid
+ and reftables.id = ref.fkeyid
+ and tables.name = 'WEB_ENTRY_EVENT'
+ OPEN refcursor
+ FETCH NEXT from refcursor into @reftable_72, @constraintname_72
+ while @@FETCH_STATUS = 0
+ BEGIN
+ exec ('alter table ' + @reftable_72 + ' drop constraint ' + @constraintname_72)
+ FETCH NEXT from refcursor into @reftable_72, @constraintname_72
+ END
+ CLOSE refcursor
+ DEALLOCATE refcursor
+ DROP TABLE [WEB_ENTRY_EVENT]
+END
+
+CREATE TABLE WEB_ENTRY_EVENT
+(
+ WEE_UID VARCHAR(32) NOT NULL,
+ PRJ_UID VARCHAR(32) NOT NULL,
+ EVN_UID VARCHAR(32) NOT NULL,
+ ACT_UID VARCHAR(32) NOT NULL,
+ DYN_UID VARCHAR(32) NOT NULL,
+ USR_UID VARCHAR(32) NOT NULL,
+ WEE_STATUS VARCHAR(10) NOT NULL DEFAULT 'ENABLED',
+ WEE_WE_UID VARCHAR(32) NOT NULL DEFAULT '',
+ WEE_WE_TAS_UID VARCHAR(32) NOT NULL DEFAULT '',
+
+ CONSTRAINT WEB_ENTRY_EVENT_PK PRIMARY KEY (WEE_UID)
+);
+
diff --git a/workflow/engine/data/mysql/schema.sql b/workflow/engine/data/mysql/schema.sql
index 11c145ed6..8e39891b3 100755
--- a/workflow/engine/data/mysql/schema.sql
+++ b/workflow/engine/data/mysql/schema.sql
@@ -2434,3 +2434,24 @@ CREATE TABLE `EMAIL_SERVER`
PRIMARY KEY (`MESS_UID`)
)ENGINE=InnoDB DEFAULT CHARSET='utf8';
+#-----------------------------------------------------------------------------
+#-- WEB_ENTRY_EVENT
+#-----------------------------------------------------------------------------
+
+DROP TABLE IF EXISTS WEB_ENTRY_EVENT;
+
+CREATE TABLE WEB_ENTRY_EVENT
+(
+ WEE_UID VARCHAR(32) NOT NULL,
+ PRJ_UID VARCHAR(32) NOT NULL,
+ EVN_UID VARCHAR(32) NOT NULL,
+ ACT_UID VARCHAR(32) NOT NULL,
+ DYN_UID VARCHAR(32) NOT NULL,
+ USR_UID VARCHAR(32) NOT NULL,
+ WEE_STATUS VARCHAR(10) NOT NULL DEFAULT 'ENABLED',
+ WEE_WE_UID VARCHAR(32) NOT NULL DEFAULT '',
+ WEE_WE_TAS_UID VARCHAR(32) NOT NULL DEFAULT '',
+
+ PRIMARY KEY (WEE_UID)
+) ENGINE=InnoDB DEFAULT CHARSET='utf8';
+
diff --git a/workflow/engine/data/oracle/schema.sql b/workflow/engine/data/oracle/schema.sql
index b565ade06..b45cbc85a 100755
--- a/workflow/engine/data/oracle/schema.sql
+++ b/workflow/engine/data/oracle/schema.sql
@@ -1889,3 +1889,27 @@ CREATE TABLE "MESSAGE_DETAIL"
ALTER TABLE "MESSAGE_DETAIL"
ADD CONSTRAINT "MESSAGE_DETAIL_PK"
PRIMARY KEY ("MD_UID");
+
+/* -----------------------------------------------------------------------
+ WEB_ENTRY_EVENT
+ ----------------------------------------------------------------------- */
+
+DROP TABLE WEB_ENTRY_EVENT CASCADE CONSTRAINTS;
+
+CREATE TABLE WEB_ENTRY_EVENT
+(
+ WEE_UID VARCHAR2(32) NOT NULL,
+ PRJ_UID VARCHAR2(32) NOT NULL,
+ EVN_UID VARCHAR2(32) NOT NULL,
+ ACT_UID VARCHAR2(32) NOT NULL,
+ DYN_UID VARCHAR2(32) NOT NULL,
+ USR_UID VARCHAR2(32) NOT NULL,
+ WEE_STATUS VARCHAR2(10) NOT NULL DEFAULT 'ENABLED',
+ WEE_WE_UID VARCHAR2(32) NOT NULL DEFAULT '',
+ WEE_WE_TAS_UID VARCHAR2(32) NOT NULL DEFAULT ''
+);
+
+ALTER TABLE WEB_ENTRY_EVENT
+ADD CONSTRAINT WEB_ENTRY_EVENT_PK
+PRIMARY KEY (WEE_UID);
+
diff --git a/workflow/engine/methods/processes/processes_Import_Ajax.php b/workflow/engine/methods/processes/processes_Import_Ajax.php
index 8e7f1ab1b..b5e6bb253 100644
--- a/workflow/engine/methods/processes/processes_Import_Ajax.php
+++ b/workflow/engine/methods/processes/processes_Import_Ajax.php
@@ -22,7 +22,7 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
-use ProcessMaker\Importer\XmlImporter;
+use \ProcessMaker\Importer\XmlImporter;
ini_set("max_execution_time", 0);
@@ -42,11 +42,11 @@ if (isset($_FILES["PROCESS_FILENAME"]) &&
if (is_object($data) && isset($data->triggers) && is_array($data->triggers) && count($data->triggers) > 0) {
/*----------------------------------********---------------------------------*/
G::LoadClass("codeScanner");
-
+
$arraySystemConfiguration = System::getSystemConfiguration(PATH_CONFIG . "env.ini");
$cs = new CodeScanner((isset($arraySystemConfiguration["enable_blacklist"]) && (int)($arraySystemConfiguration["enable_blacklist"]) == 1)? "DISABLED_CODE" : "");
$strFoundDisabledCode = "";
-
+
foreach ($data->triggers as $value) {
$arrayTriggerData = $value;
@@ -62,7 +62,7 @@ if (isset($_FILES["PROCESS_FILENAME"]) &&
$strFoundDisabledCode .= (($strFoundDisabledCode != "")? "\n" : "") . "- " . $arrayTriggerData["TRI_TITLE"] . ": " . $strCodeAndLine;
}
}
-
+
if ($strFoundDisabledCode != "") {
$response["status"] = "DISABLED-CODE";
$response["success"] = true;
diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php
index a9dca90a7..ed8d7bdd3 100644
--- a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php
+++ b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php
@@ -118,6 +118,24 @@ class WebEntry
return $newName;
}
+ /**
+ * Verify if exists the Web Entry
+ *
+ * @param string $webEntryUid Unique id of Web Entry
+ *
+ * return bool Return true if exists the Web Entry, false otherwise
+ */
+ public function exists($webEntryUid)
+ {
+ try {
+ $obj = \WebEntryPeer::retrieveByPK($webEntryUid);
+
+ return (!is_null($obj))? true : false;
+ } catch (\Exception $e) {
+ throw $e;
+ }
+ }
+
/**
* Verify if exists the title of a Web Entry
*
@@ -165,19 +183,17 @@ class WebEntry
}
/**
- * Verify if does not exist the Web Entry in table WEB_ENTRY
+ * Verify if does not exists the Web Entry
*
* @param string $webEntryUid Unique id of Web Entry
* @param string $fieldNameForException Field name for the exception
*
- * return void Throw exception if does not exist the Web Entry in table WEB_ENTRY
+ * return void Throw exception if does not exists the Web Entry
*/
public function throwExceptionIfNotExistsWebEntry($webEntryUid, $fieldNameForException)
{
try {
- $obj = \WebEntryPeer::retrieveByPK($webEntryUid);
-
- if (is_null($obj)) {
+ if (!$this->exists($webEntryUid)) {
throw new \Exception(\G::LoadTranslation("ID_WEB_ENTRY_DOES_NOT_EXIST", array($fieldNameForException, $webEntryUid)));
}
} catch (\Exception $e) {
@@ -601,7 +617,7 @@ class WebEntry
$msg = $msg . (($msg != "")? "\n" : "") . $validationFailure->getMessage();
}
- throw new \Exception(\G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . "\n" . $msg);
+ throw new \Exception(\G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . (($msg != "")? "\n" . $msg : ""));
}
} catch (\Exception $e) {
$cnn->rollback();
@@ -686,7 +702,7 @@ class WebEntry
$msg = $msg . (($msg != "")? "\n" : "") . $validationFailure->getMessage();
}
- throw new \Exception(\G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . "\n" . $msg);
+ throw new \Exception(\G::LoadTranslation("ID_REGISTRY_CANNOT_BE_UPDATED") . (($msg != "")? "\n" . $msg : ""));
}
} catch (\Exception $e) {
$cnn->rollback();
diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEvent.php b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEvent.php
new file mode 100644
index 000000000..ae8557cce
--- /dev/null
+++ b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEvent.php
@@ -0,0 +1,1000 @@
+ 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" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "dynaFormUid"),
+ "USR_UID" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "userUid"),
+
+ "WEE_TITLE" => array("type" => "string", "required" => true, "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")
+ );
+
+ private $formatFieldNameInUppercase = true;
+
+ private $arrayFieldNameForException = array(
+ "projectUid" => "PRJ_UID"
+ );
+
+ private $webEntryEventWebEntryUid = "";
+ private $webEntryEventWebEntryTaskUid = "";
+
+ private $webEntry;
+
+ /**
+ * Constructor of the class
+ *
+ * return void
+ */
+ public function __construct()
+ {
+ try {
+ $this->webEntry = new \ProcessMaker\BusinessModel\WebEntry();
+
+ foreach ($this->arrayFieldDefinition as $key => $value) {
+ $this->arrayFieldNameForException[$value["fieldNameAux"]] = $key;
+ }
+ } catch (\Exception $e) {
+ throw $e;
+ }
+ }
+
+ /**
+ * Set the format of the fields name (uppercase, lowercase)
+ *
+ * @param bool $flag Value that set the format
+ *
+ * return void
+ */
+ public function setFormatFieldNameInUppercase($flag)
+ {
+ try {
+ $this->webEntry->setFormatFieldNameInUppercase($flag);
+
+ $this->formatFieldNameInUppercase = $flag;
+
+ $this->setArrayFieldNameForException($this->arrayFieldNameForException);
+ } catch (\Exception $e) {
+ throw $e;
+ }
+ }
+
+ /**
+ * Set exception messages for fields
+ *
+ * @param array $arrayData Data with the fields
+ *
+ * return void
+ */
+ public function setArrayFieldNameForException(array $arrayData)
+ {
+ try {
+ $this->webEntry->setArrayFieldNameForException($arrayData);
+
+ foreach ($arrayData as $key => $value) {
+ $this->arrayFieldNameForException[$key] = $this->getFieldNameByFormatFieldName($value);
+ }
+ } catch (\Exception $e) {
+ throw $e;
+ }
+ }
+
+ /**
+ * Get the name of the field according to the format
+ *
+ * @param string $fieldName Field name
+ *
+ * return string Return the field name according the format
+ */
+ public function getFieldNameByFormatFieldName($fieldName)
+ {
+ try {
+ return ($this->formatFieldNameInUppercase)? strtoupper($fieldName) : strtolower($fieldName);
+ } catch (\Exception $e) {
+ throw $e;
+ }
+ }
+
+ /**
+ * Verify if exists the WebEntry-Event
+ *
+ * @param string $webEntryEventUid Unique id of WebEntry-Event
+ *
+ * return bool Return true if exists the WebEntry-Event, false otherwise
+ */
+ public function exists($webEntryEventUid)
+ {
+ try {
+ $obj = \WebEntryEventPeer::retrieveByPK($webEntryEventUid);
+
+ return (!is_null($obj))? true : false;
+ } catch (\Exception $e) {
+ throw $e;
+ }
+ }
+
+ /**
+ * Verify if exists the Event of a WebEntry-Event
+ *
+ * @param string $projectUid Unique id of Project
+ * @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
+ */
+ public function existsEvent($projectUid, $eventUid, $webEntryEventUidToExclude = "")
+ {
+ try {
+ $criteria = new \Criteria("workflow");
+
+ $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::EVN_UID, $eventUid, \Criteria::EQUAL);
+
+ $rsCriteria = \WebEntryEventPeer::doSelectRS($criteria);
+
+ return ($rsCriteria->next())? true : false;
+ } catch (\Exception $e) {
+ throw $e;
+ }
+ }
+
+ /**
+ * Verify if exists the title of a WebEntry-Event
+ *
+ * @param string $projectUid Unique id of Project
+ * @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
+ */
+ public function existsTitle($projectUid, $webEntryEventTitle, $webEntryEventUidToExclude = "")
+ {
+ try {
+ $delimiter = \DBAdapter::getStringDelimiter();
+
+ $criteria = new \Criteria("workflow");
+
+ $criteria->addSelectColumn(\WebEntryEventPeer::WEE_UID);
+
+ $criteria->addAlias("CT", \ContentPeer::TABLE_NAME);
+
+ $arrayCondition = array();
+ $arrayCondition[] = array(\WebEntryEventPeer::WEE_UID, "CT.CON_ID", \Criteria::EQUAL);
+ $arrayCondition[] = array("CT.CON_CATEGORY", $delimiter . "WEE_TITLE" . $delimiter, \Criteria::EQUAL);
+ $arrayCondition[] = array("CT.CON_LANG", $delimiter . SYS_LANG . $delimiter, \Criteria::EQUAL);
+ $criteria->addJoinMC($arrayCondition, \Criteria::LEFT_JOIN);
+
+ $criteria->add(\WebEntryEventPeer::PRJ_UID, $projectUid, \Criteria::EQUAL);
+
+ if ($webEntryEventUidToExclude != "") {
+ $criteria->add(\WebEntryEventPeer::WEE_UID, $webEntryEventUidToExclude, \Criteria::NOT_EQUAL);
+ }
+
+ $criteria->add("CT.CON_VALUE", $webEntryEventTitle, \Criteria::EQUAL);
+
+ $rsCriteria = \WebEntryEventPeer::doSelectRS($criteria);
+
+ return ($rsCriteria->next())? true : false;
+ } catch (\Exception $e) {
+ throw $e;
+ }
+ }
+
+ /**
+ * Verify if does not exists the WebEntry-Event
+ *
+ * @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
+ */
+ 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)));
+ }
+ } catch (\Exception $e) {
+ throw $e;
+ }
+ }
+
+ /**
+ * Verify if is registered the Event
+ *
+ * @param string $projectUid Unique id of Project
+ * @param string $eventUid Unique id of Event
+ * @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
+ */
+ 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)));
+ }
+ } catch (\Exception $e) {
+ throw $e;
+ }
+ }
+
+ /**
+ * Verify if exists the title of a WebEntry-Event
+ *
+ * @param string $projectUid Unique id of Project
+ * @param string $webEntryEventTitle Title
+ * @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
+ */
+ 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)));
+ }
+ } catch (\Exception $e) {
+ throw $e;
+ }
+ }
+
+ /**
+ * Validate the data if they are invalid (INSERT and UPDATE)
+ *
+ * @param string $webEntryEventUid Unique id of WebEntry-Event
+ * @param string $projectUid Unique id of Project
+ * @param array $arrayData Data
+ *
+ * return void Throw exception if data has an invalid value
+ */
+ public function throwExceptionIfDataIsInvalid($webEntryEventUid, $projectUid, array $arrayData)
+ {
+ try {
+ //Set variables
+ $arrayWebEntryEventData = ($webEntryEventUid == "")? array() : $this->getWebEntryEvent($webEntryEventUid, true);
+ $flagInsert = ($webEntryEventUid == "")? true : false;
+
+ $arrayFinalData = array_merge($arrayWebEntryEventData, $arrayData);
+
+ //Verify data - Field definition
+ $process = new \ProcessMaker\BusinessModel\Process();
+
+ $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);
+ }
+
+ 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"])));
+ }
+
+ if ($obj->getEvnType() != "START") {
+ 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);
+ }
+
+ 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"])));
+ }
+ }
+
+ if (isset($arrayData["EVN_UID"]) || isset($arrayData["ACT_UID"])) {
+ $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);
+
+ $rsCriteria = \BpmnFlowPeer::doSelectRS($criteria);
+
+ if (!$rsCriteria->next()) {
+ throw new \Exception(\G::LoadTranslation("ID_WEB_ENTRY_EVENT_FLOW_EVENT_TO_ACTIVITY_DOES_NOT_EXIST"));
+ }
+ }
+
+ if (isset($arrayData["DYN_UID"])) {
+ $dynaForm = new \ProcessMaker\BusinessModel\DynaForm();
+
+ $dynaForm->throwExceptionIfNotExistsDynaForm($arrayData["DYN_UID"], $projectUid, $this->arrayFieldNameForException["dynaFormUid"]);
+ }
+
+ if (isset($arrayData["USR_UID"])) {
+ $process->throwExceptionIfNotExistsUser($arrayData["USR_UID"], $this->arrayFieldNameForException["userUid"]);
+ }
+ } catch (\Exception $e) {
+ throw $e;
+ }
+ }
+
+ /**
+ * Create WebEntry
+ *
+ * @param string $projectUid Unique id of Project
+ * @param string $eventUid Unique id of Event
+ * @param string $activityUid Unique id of Activity
+ * @param string $dynaFormUid WebEntry, unique id of DynaForm
+ * @param string $userUid WebEntry, unique id of User
+ * @param string $title WebEntry, title
+ * @param string $description WebEntry, description
+ * @param string $userUidCreator WebEntry, unique id of creator User
+ *
+ * return void
+ */
+ public function createWebEntry($projectUid, $eventUid, $activityUid, $dynaFormUid, $userUid, $title, $description, $userUidCreator)
+ {
+ try {
+ $bpmn = new \ProcessMaker\Project\Bpmn();
+
+ $arrayEventData = $bpmn->getEvent($eventUid);
+
+ //Task
+ $task = new \Task();
+
+ $this->webEntryEventWebEntryTaskUid = $task->create(
+ array(
+ "TAS_UID" => \ProcessMaker\Util\Common::generateUID(),
+ "PRO_UID" => $projectUid,
+ "TAS_TYPE" => "WEBENTRYEVENT",
+ "TAS_TITLE" => "WEBENTRYEVENT",
+ "TAS_START" => "TRUE",
+ "TAS_POSX" => (int)($arrayEventData["BOU_X"]),
+ "TAS_POSY" => (int)($arrayEventData["BOU_Y"])
+ ),
+ false
+ );
+
+ //Task - Step
+ $step = new \Step();
+
+ $stepUid = $step->create(array("PRO_UID" => $projectUid, "TAS_UID" => $this->webEntryEventWebEntryTaskUid));
+ $result = $step->update(array("STEP_UID" => $stepUid, "STEP_TYPE_OBJ" => "DYNAFORM", "STEP_UID_OBJ" => $dynaFormUid, "STEP_POSITION" => 1, "STEP_MODE" => "EDIT"));
+
+ //Task - User
+ $task = new \Tasks();
+
+ $result = $task->assignUser($this->webEntryEventWebEntryTaskUid, $userUid, 1);
+
+ //Route
+ $workflow = \ProcessMaker\Project\Workflow::load($projectUid);
+
+ $result = $workflow->addRoute($this->webEntryEventWebEntryTaskUid, $activityUid, "SEQUENTIAL");
+
+ //WebEntry
+ $arrayWebEntryData = $this->webEntry->create(
+ $projectUid,
+ $userUidCreator,
+ array(
+ "TAS_UID" => $this->webEntryEventWebEntryTaskUid,
+ "DYN_UID" => $dynaFormUid,
+ "USR_UID" => $userUid,
+ "WE_TITLE" => $title,
+ "WE_DESCRIPTION" => $description,
+ "WE_METHOD" => "WS",
+ "WE_INPUT_DOCUMENT_ACCESS" => 1
+ )
+ );
+
+ $this->webEntryEventWebEntryUid = $arrayWebEntryData[$this->getFieldNameByFormatFieldName("WE_UID")];
+ } catch (\Exception $e) {
+ throw $e;
+ }
+ }
+
+ /**
+ * Delete WebEntry
+ *
+ * @param string $webEntryUid Unique id of WebEntry
+ * @param string $webEntryTaskUid WebEntry, unique id of Task
+ *
+ * return void
+ */
+ public function deleteWebEntry($webEntryUid, $webEntryTaskUid)
+ {
+ try {
+ if ($webEntryTaskUid != "") {
+ $obj = \TaskPeer::retrieveByPK($webEntryTaskUid);
+
+ if (!is_null($obj)) {
+ $task = new \Tasks();
+
+ $task->deleteTask($webEntryTaskUid);
+ }
+ }
+
+ if ($webEntryUid != "") {
+ $obj = \WebEntryPeer::retrieveByPK($webEntryUid);
+
+ if (!is_null($obj)) {
+ $this->webEntry->delete($webEntryUid);
+ }
+ }
+ } catch (\Exception $e) {
+ throw $e;
+ }
+ }
+
+ /**
+ * Create WebEntry-Event for a Project
+ *
+ * @param string $projectUid Unique id of Project
+ * @param string $userUidCreator Unique id of creator User
+ * @param array $arrayData Data
+ *
+ * return array Return data of the new WebEntry-Event created
+ */
+ public function create($projectUid, $userUidCreator, array $arrayData)
+ {
+ try {
+ //Verify data
+ $process = new \ProcessMaker\BusinessModel\Process();
+ $validator = new \ProcessMaker\BusinessModel\Validator();
+
+ $validator->throwExceptionIfDataIsNotArray($arrayData, "\$arrayData");
+ $validator->throwExceptionIfDataIsEmpty($arrayData, "\$arrayData");
+
+ //Set data
+ $arrayData = array_change_key_case($arrayData, CASE_UPPER);
+
+ unset($arrayData["WEE_UID"]);
+ unset($arrayData["PRJ_UID"]);
+ unset($arrayData["WEE_WE_UID"]);
+ unset($arrayData["WEE_WE_TAS_UID"]);
+
+ if (!isset($arrayData["WEE_DESCRIPTION"])) {
+ $arrayData["WEE_DESCRIPTION"] = "";
+ }
+
+ if (!isset($arrayData["WEE_STATUS"])) {
+ $arrayData["WEE_STATUS"] = "ENABLED";
+ }
+
+ //Verify data
+ $process->throwExceptionIfNotExistsProcess($projectUid, $this->arrayFieldNameForException["projectUid"]);
+
+ $this->throwExceptionIfDataIsInvalid("", $projectUid, $arrayData);
+
+ //Create
+ $cnn = \Propel::getConnection("workflow");
+
+ $this->webEntryEventWebEntryUid = "";
+ $this->webEntryEventWebEntryTaskUid = "";
+
+ try {
+ //WebEntry
+ if ($arrayData["WEE_STATUS"] == "ENABLED") {
+ $this->createWebEntry(
+ $projectUid,
+ $arrayData["EVN_UID"],
+ $arrayData["ACT_UID"],
+ $arrayData["DYN_UID"],
+ $arrayData["USR_UID"],
+ $arrayData["WEE_TITLE"],
+ $arrayData["WEE_DESCRIPTION"],
+ $userUidCreator
+ );
+ }
+
+ //WebEntry-Event
+ $webEntryEvent = new \WebEntryEvent();
+
+ $webEntryEvent->fromArray($arrayData, \BasePeer::TYPE_FIELDNAME);
+
+ $webEntryEventUid = \ProcessMaker\Util\Common::generateUID();
+
+ $webEntryEvent->setWeeUid($webEntryEventUid);
+ $webEntryEvent->setPrjUid($projectUid);
+ $webEntryEvent->setWeeWeUid($this->webEntryEventWebEntryUid);
+ $webEntryEvent->setWeeWeTasUid($this->webEntryEventWebEntryTaskUid);
+
+ if ($webEntryEvent->validate()) {
+ $cnn->begin();
+
+ $result = $webEntryEvent->save();
+
+ $cnn->commit();
+
+ //Set WEE_TITLE
+ if (isset($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"]);
+ }
+
+ //Return
+ return $this->getWebEntryEvent($webEntryEventUid);
+ } else {
+ $msg = "";
+
+ foreach ($webEntryEvent->getValidationFailures() as $validationFailure) {
+ $msg = $msg . (($msg != "")? "\n" : "") . $validationFailure->getMessage();
+ }
+
+ throw new \Exception(\G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . (($msg != "")? "\n" . $msg : ""));
+ }
+ } catch (\Exception $e) {
+ $cnn->rollback();
+
+ $this->deleteWebEntry($this->webEntryEventWebEntryUid, $this->webEntryEventWebEntryTaskUid);
+
+ throw $e;
+ }
+ } catch (\Exception $e) {
+ throw $e;
+ }
+ }
+
+ /**
+ * Update WebEntry-Event
+ *
+ * @param string $webEntryEventUid Unique id of WebEntry-Event
+ * @param string $userUidUpdater Unique id of updater User
+ * @param array $arrayData Data
+ *
+ * return array Return data of the WebEntry-Event updated
+ */
+ public function update($webEntryEventUid, $userUidUpdater, array $arrayData)
+ {
+ try {
+ //Verify data
+ $process = new \ProcessMaker\BusinessModel\Process();
+ $validator = new \ProcessMaker\BusinessModel\Validator();
+
+ $validator->throwExceptionIfDataIsNotArray($arrayData, "\$arrayData");
+ $validator->throwExceptionIfDataIsEmpty($arrayData, "\$arrayData");
+
+ //Set data
+ $arrayData = array_change_key_case($arrayData, CASE_UPPER);
+ $arrayDataBackup = $arrayData;
+
+ unset($arrayData["WEE_UID"]);
+ unset($arrayData["PRJ_UID"]);
+ unset($arrayData["WEE_WE_UID"]);
+ unset($arrayData["WEE_WE_TAS_UID"]);
+
+ //Set variables
+ $arrayWebEntryEventData = $this->getWebEntryEvent($webEntryEventUid, true);
+
+ $arrayFinalData = array_merge($arrayWebEntryEventData, $arrayData);
+
+ //Verify data
+ $this->throwExceptionIfNotExistsWebEntryEvent($webEntryEventUid, $this->arrayFieldNameForException["webEntryEventUid"]);
+
+ $this->throwExceptionIfDataIsInvalid($webEntryEventUid, $arrayWebEntryEventData["PRJ_UID"], $arrayData);
+
+ //Update
+ $cnn = \Propel::getConnection("workflow");
+
+ $this->webEntryEventWebEntryUid = "";
+ $this->webEntryEventWebEntryTaskUid = "";
+
+ try {
+ //WebEntry
+ $option = "UPDATE";
+
+ if (isset($arrayData["WEE_STATUS"])) {
+ if ($arrayData["WEE_STATUS"] == "ENABLED") {
+ if ($arrayWebEntryEventData["WEE_STATUS"] == "DISABLED") {
+ $option = "INSERT";
+ }
+ } else {
+ if ($arrayWebEntryEventData["WEE_STATUS"] == "ENABLED") {
+ $option = "DELETE";
+ }
+ }
+ }
+
+ switch ($option) {
+ case "INSERT":
+ $this->createWebEntry(
+ $arrayFinalData["PRJ_UID"],
+ $arrayFinalData["EVN_UID"],
+ $arrayFinalData["ACT_UID"],
+ $arrayFinalData["DYN_UID"],
+ $arrayFinalData["USR_UID"],
+ $arrayFinalData["WEE_TITLE"],
+ $arrayFinalData["WEE_DESCRIPTION"],
+ $userUidUpdater
+ );
+
+ $arrayData["WEE_WE_UID"] = $this->webEntryEventWebEntryUid;
+ $arrayData["WEE_WE_TAS_UID"] = $this->webEntryEventWebEntryTaskUid;
+ break;
+ case "UPDATE":
+ if ($arrayWebEntryEventData["WEE_WE_UID"] != "") {
+ $task = new \Tasks();
+
+ //Task - Step
+ if (isset($arrayData["DYN_UID"]) && $arrayData["DYN_UID"] != $arrayWebEntryEventData["DYN_UID"]) {
+ //Delete
+ $step = new \Step();
+
+ $criteria = new \Criteria("workflow");
+
+ $criteria->add(\StepPeer::TAS_UID, $arrayWebEntryEventData["WEE_WE_TAS_UID"]);
+
+ $rsCriteria = \StepPeer::doSelectRS($criteria);
+ $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
+
+ while ($rsCriteria->next()) {
+ $row = $rsCriteria->getRow();
+
+ $result = $step->remove($row["STEP_UID"]);
+ }
+
+ //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"));
+ }
+
+ //Task - User
+ if (isset($arrayData["USR_UID"]) && $arrayData["USR_UID"] != $arrayWebEntryEventData["USR_UID"]) {
+ //Unassign
+ $taskUser = new \TaskUser();
+
+ $criteria = new \Criteria("workflow");
+
+ $criteria->add(\TaskUserPeer::TAS_UID, $arrayWebEntryEventData["WEE_WE_TAS_UID"]);
+
+ $rsCriteria = \TaskUserPeer::doSelectRS($criteria);
+ $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
+
+ while ($rsCriteria->next()) {
+ $row = $rsCriteria->getRow();
+
+ $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);
+ }
+
+ //Route
+ if (isset($arrayData["ACT_UID"]) && $arrayData["ACT_UID"] != $arrayWebEntryEventData["ACT_UID"]) {
+ //Delete
+ $result = $task->deleteAllRoutesOfTask($arrayWebEntryEventData["PRJ_UID"], $arrayWebEntryEventData["WEE_WE_TAS_UID"], true);
+
+ //Add
+ $workflow = \ProcessMaker\Project\Workflow::load($arrayWebEntryEventData["PRJ_UID"]);
+
+ $result = $workflow->addRoute($arrayWebEntryEventData["WEE_WE_TAS_UID"], $arrayData["ACT_UID"], "SEQUENTIAL");
+ }
+
+ //WebEntry
+ $arrayDataAux = array();
+
+ if (isset($arrayData["DYN_UID"])) {
+ $arrayDataAux["DYN_UID"] = $arrayData["DYN_UID"];
+ }
+
+ if (isset($arrayData["USR_UID"])) {
+ $arrayDataAux["USR_UID"] = $arrayData["USR_UID"];
+ }
+
+ if (isset($arrayData["WEE_TITLE"])) {
+ $arrayDataAux["WE_TITLE"] = $arrayData["WEE_TITLE"];
+ }
+
+ if (isset($arrayData["WEE_DESCRIPTION"])) {
+ $arrayDataAux["WE_DESCRIPTION"] = $arrayData["WEE_DESCRIPTION"];
+ }
+
+ if (count($arrayDataAux) > 0) {
+ $arrayDataAux = $this->webEntry->update($arrayWebEntryEventData["WEE_WE_UID"], $userUidUpdater, $arrayDataAux);
+ }
+ }
+ break;
+ case "DELETE":
+ $this->deleteWebEntry($arrayWebEntryEventData["WEE_WE_UID"], $arrayWebEntryEventData["WEE_WE_TAS_UID"]);
+
+ $arrayData["WEE_WE_UID"] = "";
+ $arrayData["WEE_WE_TAS_UID"] = "";
+ break;
+ }
+
+ //WebEntry-Event
+ $webEntryEvent = \WebEntryEventPeer::retrieveByPK($webEntryEventUid);
+
+ $webEntryEvent->fromArray($arrayData, \BasePeer::TYPE_FIELDNAME);
+
+ if ($webEntryEvent->validate()) {
+ $cnn->begin();
+
+ $result = $webEntryEvent->save();
+
+ $cnn->commit();
+
+ //Set WEE_TITLE
+ if (isset($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"]);
+ }
+
+ //Return
+ $arrayData = $arrayDataBackup;
+
+ if (!$this->formatFieldNameInUppercase) {
+ $arrayData = array_change_key_case($arrayData, CASE_LOWER);
+ }
+
+ return $arrayData;
+ } else {
+ $msg = "";
+
+ foreach ($webEntryEvent->getValidationFailures() as $validationFailure) {
+ $msg = $msg . (($msg != "")? "\n" : "") . $validationFailure->getMessage();
+ }
+
+ throw new \Exception(\G::LoadTranslation("ID_REGISTRY_CANNOT_BE_UPDATED") . (($msg != "")? "\n" . $msg : ""));
+ }
+ } catch (\Exception $e) {
+ $this->deleteWebEntry($this->webEntryEventWebEntryUid, $this->webEntryEventWebEntryTaskUid);
+
+ throw $e;
+ }
+ } catch (\Exception $e) {
+ throw $e;
+ }
+ }
+
+ /**
+ * Delete WebEntry-Event
+ *
+ * @param string $webEntryEventUid Unique id of WebEntry-Event
+ *
+ * return void
+ */
+ public function delete($webEntryEventUid)
+ {
+ try {
+ //Verify data
+ $this->throwExceptionIfNotExistsWebEntryEvent($webEntryEventUid, $this->arrayFieldNameForException["webEntryEventUid"]);
+
+ //Set variables
+ $arrayWebEntryEventData = $this->getWebEntryEvent($webEntryEventUid, true);
+
+ //Delete WebEntry
+ $this->deleteWebEntry($arrayWebEntryEventData["WEE_WE_UID"], $arrayWebEntryEventData["WEE_WE_TAS_UID"]);
+
+ //Delete WebEntry-Event
+ $criteria = new \Criteria("workflow");
+
+ $criteria->add(\WebEntryEventPeer::WEE_UID, $webEntryEventUid, \Criteria::EQUAL);
+
+ $result = \WebEntryEventPeer::doDelete($criteria);
+ } catch (\Exception $e) {
+ throw $e;
+ }
+ }
+
+ /**
+ * Get criteria for WebEntry-Event
+ *
+ * return object
+ */
+ public function getWebEntryEventCriteria()
+ {
+ try {
+ $delimiter = \DBAdapter::getStringDelimiter();
+
+ $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("CT.CON_VALUE AS WEE_TITLE");
+ $criteria->addSelectColumn("CD.CON_VALUE AS 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->addAlias("CT", \ContentPeer::TABLE_NAME);
+ $criteria->addAlias("CD", \ContentPeer::TABLE_NAME);
+
+ $arrayCondition = array();
+ $arrayCondition[] = array(\WebEntryEventPeer::WEE_UID, "CT.CON_ID", \Criteria::EQUAL);
+ $arrayCondition[] = array("CT.CON_CATEGORY", $delimiter . "WEE_TITLE" . $delimiter, \Criteria::EQUAL);
+ $arrayCondition[] = array("CT.CON_LANG", $delimiter . SYS_LANG . $delimiter, \Criteria::EQUAL);
+ $criteria->addJoinMC($arrayCondition, \Criteria::LEFT_JOIN);
+
+ $arrayCondition = array();
+ $arrayCondition[] = array(\WebEntryEventPeer::WEE_UID, "CD.CON_ID", \Criteria::EQUAL);
+ $arrayCondition[] = array("CD.CON_CATEGORY", $delimiter . "WEE_DESCRIPTION" . $delimiter, \Criteria::EQUAL);
+ $arrayCondition[] = array("CD.CON_LANG", $delimiter . SYS_LANG . $delimiter, \Criteria::EQUAL);
+ $criteria->addJoinMC($arrayCondition, \Criteria::LEFT_JOIN);
+
+ $criteria->addJoin(\WebEntryEventPeer::WEE_WE_UID, \WebEntryPeer::WE_UID, \Criteria::LEFT_JOIN);
+
+ return $criteria;
+ } catch (\Exception $e) {
+ throw $e;
+ }
+ }
+
+ /**
+ * Get data of a WebEntry-Event from a record
+ *
+ * @param array $record Record
+ *
+ * return array Return an array with data WebEntry-Event
+ */
+ public function getWebEntryEventDataFromRecord(array $record)
+ {
+ try {
+ if ($record["WEE_WE_UID"] . "" != "") {
+ $http = (\G::is_https())? "https://" : "http://";
+ $url = $http . $_SERVER["HTTP_HOST"] . "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/" . $record["PRJ_UID"];
+
+ $record["WEE_WE_URL"] = $url . "/" . $record["WEE_WE_URL"];
+ }
+
+ return array(
+ $this->getFieldNameByFormatFieldName("WEE_UID") => $record["WEE_UID"],
+ $this->getFieldNameByFormatFieldName("EVN_UID") => $record["EVN_UID"],
+ $this->getFieldNameByFormatFieldName("ACT_UID") => $record["ACT_UID"],
+ $this->getFieldNameByFormatFieldName("DYN_UID") => $record["DYN_UID"],
+ $this->getFieldNameByFormatFieldName("USR_UID") => $record["USR_UID"],
+ $this->getFieldNameByFormatFieldName("WEE_TITLE") => $record["WEE_TITLE"],
+ $this->getFieldNameByFormatFieldName("WEE_DESCRIPTION") => $record["WEE_DESCRIPTION"] . "",
+ $this->getFieldNameByFormatFieldName("WEE_URL") => $record["WEE_WE_URL"] . "",
+ $this->getFieldNameByFormatFieldName("WEE_STATUS") => $record["WEE_STATUS"]
+ );
+ } catch (\Exception $e) {
+ throw $e;
+ }
+ }
+
+ /**
+ * Get all WebEntry-Events
+ *
+ * @param string $projectUid Unique id of Project
+ *
+ * return array Return an array with all WebEntry-Events
+ */
+ public function getWebEntryEvents($projectUid)
+ {
+ try {
+ $arrayWebEntryEvent = array();
+
+ //Verify data
+ $process = new \ProcessMaker\BusinessModel\Process();
+
+ $process->throwExceptionIfNotExistsProcess($projectUid, $this->arrayFieldNameForException["projectUid"]);
+
+ //Get data
+ $criteria = $this->getWebEntryEventCriteria();
+
+ $criteria->add(\WebEntryEventPeer::PRJ_UID, $projectUid, \Criteria::EQUAL);
+
+ $rsCriteria = \WebEntryEventPeer::doSelectRS($criteria);
+ $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
+
+ while ($rsCriteria->next()) {
+ $row = $rsCriteria->getRow();
+
+ $arrayWebEntryEvent[] = $this->getWebEntryEventDataFromRecord($row);
+ }
+
+ //Return
+ return $arrayWebEntryEvent;
+ } catch (\Exception $e) {
+ throw $e;
+ }
+ }
+
+ /**
+ * Get data of a WebEntry-Event
+ *
+ * @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
+ */
+ public function getWebEntryEvent($webEntryEventUid, $flagGetRecord = false)
+ {
+ try {
+ //Verify data
+ $this->throwExceptionIfNotExistsWebEntryEvent($webEntryEventUid, $this->arrayFieldNameForException["webEntryEventUid"]);
+
+ //Get data
+ $criteria = $this->getWebEntryEventCriteria();
+
+ $criteria->add(\WebEntryEventPeer::WEE_UID, $webEntryEventUid, \Criteria::EQUAL);
+
+ $rsCriteria = \WebEntryEventPeer::doSelectRS($criteria);
+ $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
+
+ $rsCriteria->next();
+
+ $row = $rsCriteria->getRow();
+
+ //Return
+ return (!$flagGetRecord)? $this->getWebEntryEventDataFromRecord($row) : $row;
+ } catch (\Exception $e) {
+ throw $e;
+ }
+ }
+
+ /**
+ * Get data of a WebEntry-Event by unique id of Event
+ *
+ * @param string $projectUid Unique id of Project
+ * @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
+ */
+ public function getWebEntryEventByEvent($projectUid, $eventUid, $flagGetRecord = false)
+ {
+ try {
+ //Verify data
+ $process = new \ProcessMaker\BusinessModel\Process();
+
+ $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)));
+ }
+
+ //Get data
+ $criteria = $this->getWebEntryEventCriteria();
+
+ $criteria->add(\WebEntryEventPeer::PRJ_UID, $projectUid, \Criteria::EQUAL);
+ $criteria->add(\WebEntryEventPeer::EVN_UID, $eventUid, \Criteria::EQUAL);
+
+ $rsCriteria = \WebEntryEventPeer::doSelectRS($criteria);
+ $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
+
+ $rsCriteria->next();
+
+ $row = $rsCriteria->getRow();
+
+ //Return
+ return (!$flagGetRecord)? $this->getWebEntryEventDataFromRecord($row) : $row;
+ } catch (\Exception $e) {
+ throw $e;
+ }
+ }
+}
+
diff --git a/workflow/engine/src/ProcessMaker/Importer/Importer.php b/workflow/engine/src/ProcessMaker/Importer/Importer.php
index 7d789accf..aa3847f0b 100755
--- a/workflow/engine/src/ProcessMaker/Importer/Importer.php
+++ b/workflow/engine/src/ProcessMaker/Importer/Importer.php
@@ -369,12 +369,14 @@ abstract class Importer
$this->importWfFiles($arrayWorkflowFiles);
//Update
- $workflow = Project\Workflow::load($projectUid);
+ $workflow = \ProcessMaker\Project\Workflow::load($projectUid);
foreach ($arrayWorkflowTables["tasks"] as $key => $value) {
$arrayTaskData = $value;
- $result = $workflow->updateTask($arrayTaskData["TAS_UID"], $arrayTaskData);
+ if (!in_array($arrayTaskData["TAS_TYPE"], array("GATEWAYTOGATEWAY", "WEBENTRYEVENT"))) {
+ $result = $workflow->updateTask($arrayTaskData["TAS_UID"], $arrayTaskData);
+ }
}
unset($arrayWorkflowTables["process"]["PRO_CREATE_USER"]);
diff --git a/workflow/engine/src/ProcessMaker/Project/Adapter/BpmnWorkflow.php b/workflow/engine/src/ProcessMaker/Project/Adapter/BpmnWorkflow.php
index a90cca2b1..c93d6bbb9 100755
--- a/workflow/engine/src/ProcessMaker/Project/Adapter/BpmnWorkflow.php
+++ b/workflow/engine/src/ProcessMaker/Project/Adapter/BpmnWorkflow.php
@@ -243,6 +243,9 @@ class BpmnWorkflow extends Project\Bpmn
}
$this->updateEventStartObjects($data["FLO_ELEMENT_ORIGIN"], $data["FLO_ELEMENT_DEST"]);
+
+ //WebEntry-Event - Update
+ $this->updateWebEntryEventByEvent($data["FLO_ELEMENT_ORIGIN"], array("ACT_UID" => $data["FLO_ELEMENT_DEST"]));
break;
}
break;
@@ -289,6 +292,9 @@ class BpmnWorkflow extends Project\Bpmn
$this->wp->setStartTask($flowCurrent->getFloElementDest());
$this->updateEventStartObjects($flowCurrent->getFloElementOrigin(), $flowCurrent->getFloElementDest());
+
+ //WebEntry-Event - Update
+ $this->updateWebEntryEventByEvent($flowCurrent->getFloElementOrigin(), array("ACT_UID" => $flowCurrent->getFloElementDest()));
}
}
@@ -342,16 +348,31 @@ class BpmnWorkflow extends Project\Bpmn
if ($flow->getFloElementOriginType() == "bpmnEvent" &&
$flow->getFloElementDestType() == "bpmnActivity"
) {
- $event = \BpmnEventPeer::retrieveByPK($flow->getFloElementOrigin());
+ $bpmnFlow = \BpmnFlow::findOneBy(array(
+ \BpmnFlowPeer::FLO_ELEMENT_ORIGIN => $flow->getFloElementOrigin(),
+ \BpmnFlowPeer::FLO_ELEMENT_ORIGIN_TYPE => "bpmnEvent",
+ \BpmnFlowPeer::FLO_ELEMENT_DEST => $flow->getFloElementDest(),
+ \BpmnFlowPeer::FLO_ELEMENT_DEST_TYPE => "bpmnActivity"
+ ));
- if (! is_null($event) && $event->getEvnType() == "START") {
- $activity = \BpmnActivityPeer::retrieveByPK($flow->getFloElementDest());
- if (! is_null($activity)) {
- $this->wp->setStartTask($activity->getActUid(), false);
+ if (is_null($bpmnFlow)) {
+ $event = \BpmnEventPeer::retrieveByPK($flow->getFloElementOrigin());
+
+ if (!is_null($event) && $event->getEvnType() == "START") {
+ $activity = \BpmnActivityPeer::retrieveByPK($flow->getFloElementDest());
+
+ if (!is_null($activity)) {
+ $this->wp->setStartTask($activity->getActUid(), false);
+ }
}
}
$this->updateEventStartObjects($flow->getFloElementOrigin(), "");
+
+ //WebEntry-Event - Update
+ if (is_null($bpmnFlow)) {
+ $this->updateWebEntryEventByEvent($flow->getFloElementOrigin(), array("WEE_STATUS" => "DISABLED"));
+ }
} elseif ($flow->getFloElementOriginType() == "bpmnActivity" &&
$flow->getFloElementDestType() == "bpmnEvent") {
// verify case: activity -> event(end)
@@ -403,22 +424,27 @@ class BpmnWorkflow extends Project\Bpmn
return $eventUid;
}
- public function removeEvent($data)
+ public function removeEvent($eventUid)
{
-
- $event = \BpmnEventPeer::retrieveByPK($data);
+ $event = \BpmnEventPeer::retrieveByPK($eventUid);
// delete case scheduler
if ($event && $event->getEvnMarker() == "TIMER" && $event->getEvnType() == "START") {
- $this->wp->removeCaseScheduler($data);
+ $this->wp->removeCaseScheduler($eventUid);
}
// delete web entry
- if ($event && $event->getEvnMarker() == "MESSAGE" && $event->getEvnType() == "START") {
- $this->wp->removeWebEntry($data);
+ if (!is_null($event) && $event->getEvnType() == "START") {
+ $webEntryEvent = new \ProcessMaker\BusinessModel\WebEntryEvent();
+
+ if ($webEntryEvent->existsEvent($event->getPrjUid(), $eventUid)) {
+ $arrayWebEntryEventData = $webEntryEvent->getWebEntryEventByEvent($event->getPrjUid(), $eventUid, true);
+
+ $webEntryEvent->delete($arrayWebEntryEventData["WEE_UID"]);
+ }
}
- parent::removeEvent($data);
+ parent::removeEvent($eventUid);
}
public function updateEventStartObjects($eventUid, $taskUid)
@@ -431,9 +457,9 @@ class BpmnWorkflow extends Project\Bpmn
}
//Update web entry
- if (!is_null($event) && $event->getEvnType() == "START" && $event->getEvnMarker() == "MESSAGE") {
- $this->wp->updateWebEntry($eventUid, array("TAS_UID" => $taskUid));
- }
+ //if (!is_null($event) && $event->getEvnType() == "START" && $event->getEvnMarker() == "MESSAGE") {
+ // $this->wp->updateWebEntry($eventUid, array("TAS_UID" => $taskUid));
+ //}
}
public function mapBpmnGatewayToWorkflowRoutes($activityUid, $gatewayUid)
@@ -1302,5 +1328,27 @@ class BpmnWorkflow extends Project\Bpmn
parent::setDisabled($value);
$this->wp->setDisabled($value);
}
+
+ public function updateWebEntryEventByEvent($eventUid, array $arrayData)
+ {
+ try {
+ $bpmnEvent = \BpmnEventPeer::retrieveByPK($eventUid);
+
+ if (!is_null($bpmnEvent) && $bpmnEvent->getEvnType() == "START") {
+ $webEntryEvent = new \ProcessMaker\BusinessModel\WebEntryEvent();
+
+ if ($webEntryEvent->existsEvent($bpmnEvent->getPrjUid(), $bpmnEvent->getEvnUid())) {
+ $arrayWebEntryEventData = $webEntryEvent->getWebEntryEventByEvent($bpmnEvent->getPrjUid(), $bpmnEvent->getEvnUid(), true);
+
+ $bpmn = \ProcessMaker\Project\Bpmn::load($bpmnEvent->getPrjUid());
+ $bpmnProject = $bpmn->getProject("object");
+
+ $arrayResult = $webEntryEvent->update($arrayWebEntryEventData["WEE_UID"], $bpmnProject->getPrjAuthor(), $arrayData);
+ }
+ }
+ } catch (\Exception $e) {
+ throw $e;
+ }
+ }
}
diff --git a/workflow/engine/src/ProcessMaker/Project/Workflow.php b/workflow/engine/src/ProcessMaker/Project/Workflow.php
index 2cd8698a2..752cbc2fa 100644
--- a/workflow/engine/src/ProcessMaker/Project/Workflow.php
+++ b/workflow/engine/src/ProcessMaker/Project/Workflow.php
@@ -764,10 +764,11 @@ class Workflow extends Handler
$oCriteria->add(\CaseTrackerObjectPeer::PRO_UID, $sProcessUID);
\ProcessUserPeer::doDelete($oCriteria);
- //Delete Web Entries
+ //Delete WebEntries
$webEntry = new \ProcessMaker\BusinessModel\WebEntry();
$criteria = new \Criteria("workflow");
+
$criteria->addSelectColumn(\WebEntryPeer::WE_UID);
$criteria->add(\WebEntryPeer::PRO_UID, $sProcessUID, \Criteria::EQUAL);
@@ -780,6 +781,23 @@ class Workflow extends Handler
$webEntry->delete($row["WE_UID"]);
}
+ //Delete WebEntry-Events
+ $webEntryEvent = new \ProcessMaker\BusinessModel\WebEntryEvent();
+
+ $criteria = new \Criteria("workflow");
+
+ $criteria->addSelectColumn(\WebEntryEventPeer::WEE_UID);
+ $criteria->add(\WebEntryEventPeer::PRJ_UID, $sProcessUID, \Criteria::EQUAL);
+
+ $rsCriteria = \WebEntryEventPeer::doSelectRS($criteria);
+ $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
+
+ while ($rsCriteria->next()) {
+ $row = $rsCriteria->getRow();
+
+ $webEntryEvent->delete($row["WEE_UID"]);
+ }
+
//Delete the process
try {
$oProcess->remove($sProcessUID);
@@ -1055,7 +1073,27 @@ class Workflow extends Handler
}
}
- //Getting templates files
+ //Get public files to exclude
+ $arrayPublicFileToExclude = array("wsClient.php");
+
+ //WebEntry
+ $criteria = new \Criteria("workflow");
+
+ $criteria->addSelectColumn(\WebEntryPeer::WE_DATA);
+ $criteria->add(\WebEntryPeer::PRO_UID, $processUid, \Criteria::EQUAL);
+ $criteria->add(\WebEntryPeer::WE_METHOD, "WS", \Criteria::EQUAL);
+
+ $rsCriteria = \WebEntryPeer::doSelectRS($criteria);
+ $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
+
+ while ($rsCriteria->next()) {
+ $row = $rsCriteria->getRow();
+
+ $arrayPublicFileToExclude[] = $row["WE_DATA"];
+ $arrayPublicFileToExclude[] = preg_replace("/^(.+)\.php$/", "$1Post.php", $row["WE_DATA"]);
+ }
+
+ //Get templates and public files
$workspaceTargetDirs = array("TEMPLATES" => "mailTemplates", "PUBLIC" => "public");
$workspaceDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP;
@@ -1070,6 +1108,10 @@ class Workflow extends Handler
$filename = basename($templatesFile);
+ if ($target == "PUBLIC" && in_array($filename, $arrayPublicFileToExclude)) {
+ continue;
+ }
+
$workflowFile[$target][] = array(
"filename" => $filename,
"filepath" => $processUid . PATH_SEP . $filename,
@@ -1095,7 +1137,7 @@ class Workflow extends Handler
$processUidOld = $arrayUid[0]["old_uid"];
$processUid = $arrayUid[0]["new_uid"];
- //Update TAS_UID
+ //Update TASK.TAS_UID
foreach ($arrayWorkflowData["tasks"] as $key => $value) {
$taskUid = $arrayWorkflowData["tasks"][$key]["TAS_UID"];
@@ -1110,6 +1152,20 @@ class Workflow extends Handler
}
}
+ //Update WEB_ENTRY_EVENT.EVN_UID
+ foreach ($arrayWorkflowData["webEntryEvent"] as $key => $value) {
+ $webEntryEventEventUid = $arrayWorkflowData["webEntryEvent"][$key]["EVN_UID"];
+
+ foreach ($arrayUid as $value2) {
+ $arrayItem = $value2;
+
+ if ($arrayItem["old_uid"] == $webEntryEventEventUid) {
+ $arrayWorkflowData["webEntryEvent"][$key]["EVN_UID"] = $arrayItem["new_uid"];
+ break;
+ }
+ }
+ }
+
//Workflow tables
$workflowData = (object)($arrayWorkflowData);
diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Project/WebEntryEvent.php b/workflow/engine/src/ProcessMaker/Services/Api/Project/WebEntryEvent.php
new file mode 100644
index 000000000..b50cbd227
--- /dev/null
+++ b/workflow/engine/src/ProcessMaker/Services/Api/Project/WebEntryEvent.php
@@ -0,0 +1,135 @@
+webEntryEvent = new \ProcessMaker\BusinessModel\WebEntryEvent();
+
+ $this->webEntryEvent->setFormatFieldNameInUppercase(false);
+ $this->webEntryEvent->setArrayFieldNameForException(array("processUid" => "prj_uid"));
+ } catch (\Exception $e) {
+ throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
+ }
+ }
+
+ /**
+ * @url GET /:prj_uid/web-entry-events
+ *
+ * @param string $prj_uid {@min 32}{@max 32}
+ */
+ public function doGetWebEntryEvents($prj_uid)
+ {
+ try {
+ $response = $this->webEntryEvent->getWebEntryEvents($prj_uid);
+
+ return $response;
+ } catch (\Exception $e) {
+ throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
+ }
+ }
+
+ /**
+ * @url GET /:prj_uid/web-entry-event/:wee_uid
+ *
+ * @param string $prj_uid {@min 32}{@max 32}
+ * @param string $wee_uid {@min 32}{@max 32}
+ */
+ public function doGetWebEntryEvent($prj_uid, $wee_uid)
+ {
+ try {
+ $response = $this->webEntryEvent->getWebEntryEvent($wee_uid);
+
+ return $response;
+ } catch (\Exception $e) {
+ throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
+ }
+ }
+
+ /**
+ * @url GET /:prj_uid/web-entry-event/event/:evn_uid
+ *
+ * @param string $prj_uid {@min 32}{@max 32}
+ * @param string $evn_uid {@min 32}{@max 32}
+ */
+ public function doGetWebEntryEventEvent($prj_uid, $evn_uid)
+ {
+ try {
+ $response = $this->webEntryEvent->getWebEntryEventByEvent($prj_uid, $evn_uid);
+
+ return $response;
+ } catch (\Exception $e) {
+ throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
+ }
+ }
+
+ /**
+ * @url POST /:prj_uid/web-entry-event
+ *
+ * @param string $prj_uid {@min 32}{@max 32}
+ * @param array $request_data
+ *
+ * @status 201
+ */
+ public function doPostWebEntryEvent($prj_uid, array $request_data)
+ {
+ try {
+ $arrayData = $this->webEntryEvent->create($prj_uid, $this->getUserId(), $request_data);
+
+ $response = $arrayData;
+
+ return $response;
+ } catch (\Exception $e) {
+ throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
+ }
+ }
+
+ /**
+ * @url PUT /:prj_uid/web-entry-event/:wee_uid
+ *
+ * @param string $prj_uid {@min 32}{@max 32}
+ * @param string $wee_uid {@min 32}{@max 32}
+ * @param array $request_data
+ */
+ public function doPutWebEntryEvent($prj_uid, $wee_uid, array $request_data)
+ {
+ try {
+ $arrayData = $this->webEntryEvent->update($wee_uid, $this->getUserId(), $request_data);
+ } catch (\Exception $e) {
+ throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
+ }
+ }
+
+ /**
+ * @url DELETE /:prj_uid/web-entry-event/:wee_uid
+ *
+ * @param string $prj_uid {@min 32}{@max 32}
+ * @param string $wee_uid {@min 32}{@max 32}
+ */
+ public function doDeleteWebEntryEvent($prj_uid, $wee_uid)
+ {
+ try {
+ $this->webEntryEvent->delete($wee_uid);
+ } catch (\Exception $e) {
+ throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
+ }
+ }
+}
+
diff --git a/workflow/engine/src/ProcessMaker/Services/api.ini b/workflow/engine/src/ProcessMaker/Services/api.ini
index 5f0dfbbb5..42a1ea4ca 100644
--- a/workflow/engine/src/ProcessMaker/Services/api.ini
+++ b/workflow/engine/src/ProcessMaker/Services/api.ini
@@ -37,7 +37,8 @@ debug = 1
trigger-wizard = "ProcessMaker\Services\Api\Project\TriggerWizard"
category = "ProcessMaker\Services\Api\ProcessCategory"
process-variable = "ProcessMaker\Services\Api\Project\Variable"
- message = "ProcessMaker\Services\Api\Project\Message"
+ message = "ProcessMaker\Services\Api\Project\Message"
+ web-entry-event = "ProcessMaker\Services\Api\Project\WebEntryEvent"
[alias: projects]
project = "ProcessMaker\Services\Api\Project"
@@ -94,3 +95,4 @@ debug = 1
[alias: emails]
email = "ProcessMaker\Services\Api\EmailServer"
+