diff --git a/workflow/engine/classes/class.case.php b/workflow/engine/classes/class.case.php index 741e76b9c..ef75a729a 100644 --- a/workflow/engine/classes/class.case.php +++ b/workflow/engine/classes/class.case.php @@ -1,5 +1,7 @@ 'char', 'value' => 'char'); $tasks = array(); - - $arrayTaskTypeToExclude = array("WEBENTRYEVENT", "END-MESSAGE-EVENT", "START-MESSAGE-EVENT", "INTERMEDIATE-THROW-MESSAGE-EVENT", "INTERMEDIATE-CATCH-MESSAGE-EVENT", "SCRIPT-TASK", "START-TIMER-EVENT", "INTERMEDIATE-CATCH-TIMER-EVENT"); - + $arrayTaskTypeToExclude = array( + "WEBENTRYEVENT", + "END-MESSAGE-EVENT", + "START-MESSAGE-EVENT", + "INTERMEDIATE-THROW-MESSAGE-EVENT", + "INTERMEDIATE-CATCH-MESSAGE-EVENT", + "SCRIPT-TASK", + "START-TIMER-EVENT", + "INTERMEDIATE-CATCH-TIMER-EVENT" + ); + $webEntryEvent = new WebEntryEvent(); + $arrayWebEntryEvent = array(); + //Set the parameter $considerShowInCase=true, to consider the WE_SHOW_IN_CASE + //configuration to filter the Start events with WebEntry. + $allWebEntryEvents = $webEntryEvent->getAllWebEntryEvents(true); + foreach ($allWebEntryEvents as $webEntryEvents) { + $arrayWebEntryEvent[] = $webEntryEvents["ACT_UID"]; + } $c = new Criteria(); $c->clearSelectColumns(); $c->addSelectColumn(TaskPeer::TAS_UID); @@ -209,6 +226,7 @@ class Cases $c->add(ProcessPeer::PRO_STATUS, 'ACTIVE'); $c->add(ProcessPeer::PRO_SUBPROCESS, '0'); $c->add(TaskPeer::TAS_TYPE, $arrayTaskTypeToExclude, Criteria::NOT_IN); + $c->add(TaskPeer::TAS_UID, $arrayWebEntryEvent, Criteria::NOT_IN); $c->add(TaskPeer::TAS_START, 'TRUE'); $c->add(TaskUserPeer::USR_UID, $sUIDUser); $c->add(TaskUserPeer::TU_TYPE, 1); @@ -221,12 +239,9 @@ class Cases $rs->next(); $row = $rs->getRow(); } - //check groups - G::LoadClass('groups'); $group = new Groups(); $aGroups = $group->getActiveGroupsForAnUser($sUIDUser); - $c = new Criteria(); $c->clearSelectColumns(); $c->addSelectColumn(TaskPeer::TAS_UID); @@ -236,6 +251,7 @@ class Cases $c->add(ProcessPeer::PRO_STATUS, 'ACTIVE'); $c->add(ProcessPeer::PRO_SUBPROCESS, '0'); $c->add(TaskPeer::TAS_TYPE, $arrayTaskTypeToExclude, Criteria::NOT_IN); + $c->add(TaskPeer::TAS_UID, $arrayWebEntryEvent, Criteria::NOT_IN); $c->add(TaskPeer::TAS_START, 'TRUE'); $c->add(TaskUserPeer::USR_UID, $aGroups, Criteria::IN); $c->add(TaskUserPeer::TU_TYPE, 1); @@ -248,7 +264,6 @@ class Cases $rs->next(); $row = $rs->getRow(); } - $c = new Criteria(); $c->addSelectColumn(TaskPeer::TAS_UID); $c->addSelectColumn(TaskPeer::TAS_TITLE); @@ -266,20 +281,17 @@ class Cases $aConditions[] = array('PCS.PRO_CATEGORY', 'PCSCAT.CATEGORY_UID'); $c->addJoinMC($aConditions, Criteria::LEFT_JOIN); } - $c->addJoin (TaskPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN); $c->add(TaskPeer::TAS_UID, $tasks, Criteria::IN); $c->add(ProcessPeer::PRO_SUBPROCESS, '0'); - $c->addAscendingOrderByColumn(ProcessPeer::PRO_TITLE); $c->addAscendingOrderByColumn(TaskPeer::TAS_TITLE); - $rs = TaskPeer::doSelectRS($c); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rs->next(); $countTaskLabel = 1; while ($row = $rs->getRow()) { - if($row['TAS_TITLE'] != ''){ + if ($row['TAS_TITLE'] != '') { $taskTitleLabel = $row['TAS_TITLE']; } else { $taskTitleLabel = G::LoadTranslation('ID_UNTITLED_TASK').' '.$countTaskLabel; @@ -289,7 +301,7 @@ class Cases $taskTitle = TaskPeer::retrieveByPK($row['TAS_UID']); $row['TAS_TITLE'] = $taskTitle->getTasTitle(); $row['CATEGORY_NAME'] = ($row['CATEGORY_NAME'] == '') ? - G::LoadTranslation('ID_PROCESS_NOCATEGORY') : $row['CATEGORY_NAME']; + G::LoadTranslation('ID_PROCESS_NOCATEGORY') : $row['CATEGORY_NAME']; $rows[] = array( 'uid' => $row['TAS_UID'], 'value' => $row['PRO_TITLE'] . ' (' . $taskTitleLabel . ')', @@ -307,12 +319,10 @@ class Cases $rs->next(); $row = $rs->getRow(); } - $rowsToReturn = $rows; if ($typeView === 'category') { $rowsToReturn = $this->orderStartCasesByCategoryAndName($rows); } - return $rowsToReturn; } diff --git a/workflow/engine/classes/model/map/WebEntryMapBuilder.php b/workflow/engine/classes/model/map/WebEntryMapBuilder.php index d6a5d0844..65d6c66f5 100644 --- a/workflow/engine/classes/model/map/WebEntryMapBuilder.php +++ b/workflow/engine/classes/model/map/WebEntryMapBuilder.php @@ -109,6 +109,8 @@ class WebEntryMapBuilder $tMap->addColumn('WE_LINK_DOMAIN', 'WeLinkDomain', 'string', CreoleTypes::LONGVARCHAR, false, null); + $tMap->addColumn('WE_SHOW_IN_NEW_CASE', 'WeShowInNewCase', 'string', CreoleTypes::CHAR, false, 1); + $tMap->addValidator('WE_TYPE', 'validValues', 'propel.validator.ValidValuesValidator', 'SINGLE|MULTIPLE', 'Please enter a valid value for WE_TYPE'); $tMap->addValidator('WE_AUTHENTICATION', 'validValues', 'propel.validator.ValidValuesValidator', 'ANONYMOUS|LOGIN_REQUIRED', 'Please enter a valid value for WE_AUTHENTICATION'); diff --git a/workflow/engine/classes/model/om/BaseWebEntry.php b/workflow/engine/classes/model/om/BaseWebEntry.php index 77821569e..b2544ed8a 100644 --- a/workflow/engine/classes/model/om/BaseWebEntry.php +++ b/workflow/engine/classes/model/om/BaseWebEntry.php @@ -159,6 +159,12 @@ abstract class BaseWebEntry extends BaseObject implements Persistent */ protected $we_link_domain; + /** + * The value for the we_show_in_new_case field. + * @var string + */ + protected $we_show_in_new_case = '1'; + /** * Flag to prevent endless save loop, if this object is referenced * by another object which falls in this transaction. @@ -457,6 +463,17 @@ abstract class BaseWebEntry extends BaseObject implements Persistent return $this->we_link_domain; } + /** + * Get the [we_show_in_new_case] column value. + * + * @return string + */ + public function getWeShowInNewCase() + { + + return $this->we_show_in_new_case; + } + /** * Set the value of [we_uid] column. * @@ -955,6 +972,28 @@ abstract class BaseWebEntry extends BaseObject implements Persistent } // setWeLinkDomain() + /** + * Set the value of [we_show_in_new_case] column. + * + * @param string $v new value + * @return void + */ + public function setWeShowInNewCase($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->we_show_in_new_case !== $v || $v === '1') { + $this->we_show_in_new_case = $v; + $this->modifiedColumns[] = WebEntryPeer::WE_SHOW_IN_NEW_CASE; + } + + } // setWeShowInNewCase() + /** * Hydrates (populates) the object variables with values from the database resultset. * @@ -1016,12 +1055,14 @@ abstract class BaseWebEntry extends BaseObject implements Persistent $this->we_link_domain = $rs->getString($startcol + 21); + $this->we_show_in_new_case = $rs->getString($startcol + 22); + $this->resetModified(); $this->setNew(false); // FIXME - using NUM_COLUMNS may be clearer. - return $startcol + 22; // 22 = WebEntryPeer::NUM_COLUMNS - WebEntryPeer::NUM_LAZY_LOAD_COLUMNS). + return $startcol + 23; // 23 = WebEntryPeer::NUM_COLUMNS - WebEntryPeer::NUM_LAZY_LOAD_COLUMNS). } catch (Exception $e) { throw new PropelException("Error populating WebEntry object", $e); @@ -1291,6 +1332,9 @@ abstract class BaseWebEntry extends BaseObject implements Persistent case 21: return $this->getWeLinkDomain(); break; + case 22: + return $this->getWeShowInNewCase(); + break; default: return null; break; @@ -1333,6 +1377,7 @@ abstract class BaseWebEntry extends BaseObject implements Persistent $keys[19] => $this->getWeLinkSkin(), $keys[20] => $this->getWeLinkLanguage(), $keys[21] => $this->getWeLinkDomain(), + $keys[22] => $this->getWeShowInNewCase(), ); return $result; } @@ -1430,6 +1475,9 @@ abstract class BaseWebEntry extends BaseObject implements Persistent case 21: $this->setWeLinkDomain($value); break; + case 22: + $this->setWeShowInNewCase($value); + break; } // switch() } @@ -1541,6 +1589,10 @@ abstract class BaseWebEntry extends BaseObject implements Persistent $this->setWeLinkDomain($arr[$keys[21]]); } + if (array_key_exists($keys[22], $arr)) { + $this->setWeShowInNewCase($arr[$keys[22]]); + } + } /** @@ -1640,6 +1692,10 @@ abstract class BaseWebEntry extends BaseObject implements Persistent $criteria->add(WebEntryPeer::WE_LINK_DOMAIN, $this->we_link_domain); } + if ($this->isColumnModified(WebEntryPeer::WE_SHOW_IN_NEW_CASE)) { + $criteria->add(WebEntryPeer::WE_SHOW_IN_NEW_CASE, $this->we_show_in_new_case); + } + return $criteria; } @@ -1736,6 +1792,8 @@ abstract class BaseWebEntry extends BaseObject implements Persistent $copyObj->setWeLinkDomain($this->we_link_domain); + $copyObj->setWeShowInNewCase($this->we_show_in_new_case); + $copyObj->setNew(true); diff --git a/workflow/engine/classes/model/om/BaseWebEntryPeer.php b/workflow/engine/classes/model/om/BaseWebEntryPeer.php index e86291fc3..dac63fa3f 100644 --- a/workflow/engine/classes/model/om/BaseWebEntryPeer.php +++ b/workflow/engine/classes/model/om/BaseWebEntryPeer.php @@ -25,7 +25,7 @@ abstract class BaseWebEntryPeer const CLASS_DEFAULT = 'classes.model.WebEntry'; /** The total number of columns. */ - const NUM_COLUMNS = 22; + const NUM_COLUMNS = 23; /** The number of lazy-loaded columns. */ const NUM_LAZY_LOAD_COLUMNS = 0; @@ -97,6 +97,9 @@ abstract class BaseWebEntryPeer /** the column name for the WE_LINK_DOMAIN field */ const WE_LINK_DOMAIN = 'WEB_ENTRY.WE_LINK_DOMAIN'; + /** the column name for the WE_SHOW_IN_NEW_CASE field */ + const WE_SHOW_IN_NEW_CASE = 'WEB_ENTRY.WE_SHOW_IN_NEW_CASE'; + /** The PHP to DB Name Mapping */ private static $phpNameMap = null; @@ -108,10 +111,10 @@ abstract class BaseWebEntryPeer * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ private static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('WeUid', 'ProUid', 'TasUid', 'DynUid', 'UsrUid', 'WeMethod', 'WeInputDocumentAccess', 'WeData', 'WeCreateUsrUid', 'WeUpdateUsrUid', 'WeCreateDate', 'WeUpdateDate', 'WeType', 'WeCustomTitle', 'WeAuthentication', 'WeHideInformationBar', 'WeCallback', 'WeCallbackUrl', 'WeLinkGeneration', 'WeLinkSkin', 'WeLinkLanguage', 'WeLinkDomain', ), - BasePeer::TYPE_COLNAME => array (WebEntryPeer::WE_UID, WebEntryPeer::PRO_UID, WebEntryPeer::TAS_UID, WebEntryPeer::DYN_UID, WebEntryPeer::USR_UID, WebEntryPeer::WE_METHOD, WebEntryPeer::WE_INPUT_DOCUMENT_ACCESS, WebEntryPeer::WE_DATA, WebEntryPeer::WE_CREATE_USR_UID, WebEntryPeer::WE_UPDATE_USR_UID, WebEntryPeer::WE_CREATE_DATE, WebEntryPeer::WE_UPDATE_DATE, WebEntryPeer::WE_TYPE, WebEntryPeer::WE_CUSTOM_TITLE, WebEntryPeer::WE_AUTHENTICATION, WebEntryPeer::WE_HIDE_INFORMATION_BAR, WebEntryPeer::WE_CALLBACK, WebEntryPeer::WE_CALLBACK_URL, WebEntryPeer::WE_LINK_GENERATION, WebEntryPeer::WE_LINK_SKIN, WebEntryPeer::WE_LINK_LANGUAGE, WebEntryPeer::WE_LINK_DOMAIN, ), - BasePeer::TYPE_FIELDNAME => array ('WE_UID', 'PRO_UID', 'TAS_UID', 'DYN_UID', 'USR_UID', 'WE_METHOD', 'WE_INPUT_DOCUMENT_ACCESS', 'WE_DATA', 'WE_CREATE_USR_UID', 'WE_UPDATE_USR_UID', 'WE_CREATE_DATE', 'WE_UPDATE_DATE', 'WE_TYPE', 'WE_CUSTOM_TITLE', 'WE_AUTHENTICATION', 'WE_HIDE_INFORMATION_BAR', 'WE_CALLBACK', 'WE_CALLBACK_URL', 'WE_LINK_GENERATION', 'WE_LINK_SKIN', 'WE_LINK_LANGUAGE', 'WE_LINK_DOMAIN', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, ) + BasePeer::TYPE_PHPNAME => array ('WeUid', 'ProUid', 'TasUid', 'DynUid', 'UsrUid', 'WeMethod', 'WeInputDocumentAccess', 'WeData', 'WeCreateUsrUid', 'WeUpdateUsrUid', 'WeCreateDate', 'WeUpdateDate', 'WeType', 'WeCustomTitle', 'WeAuthentication', 'WeHideInformationBar', 'WeCallback', 'WeCallbackUrl', 'WeLinkGeneration', 'WeLinkSkin', 'WeLinkLanguage', 'WeLinkDomain', 'WeShowInNewCase', ), + BasePeer::TYPE_COLNAME => array (WebEntryPeer::WE_UID, WebEntryPeer::PRO_UID, WebEntryPeer::TAS_UID, WebEntryPeer::DYN_UID, WebEntryPeer::USR_UID, WebEntryPeer::WE_METHOD, WebEntryPeer::WE_INPUT_DOCUMENT_ACCESS, WebEntryPeer::WE_DATA, WebEntryPeer::WE_CREATE_USR_UID, WebEntryPeer::WE_UPDATE_USR_UID, WebEntryPeer::WE_CREATE_DATE, WebEntryPeer::WE_UPDATE_DATE, WebEntryPeer::WE_TYPE, WebEntryPeer::WE_CUSTOM_TITLE, WebEntryPeer::WE_AUTHENTICATION, WebEntryPeer::WE_HIDE_INFORMATION_BAR, WebEntryPeer::WE_CALLBACK, WebEntryPeer::WE_CALLBACK_URL, WebEntryPeer::WE_LINK_GENERATION, WebEntryPeer::WE_LINK_SKIN, WebEntryPeer::WE_LINK_LANGUAGE, WebEntryPeer::WE_LINK_DOMAIN, WebEntryPeer::WE_SHOW_IN_NEW_CASE, ), + BasePeer::TYPE_FIELDNAME => array ('WE_UID', 'PRO_UID', 'TAS_UID', 'DYN_UID', 'USR_UID', 'WE_METHOD', 'WE_INPUT_DOCUMENT_ACCESS', 'WE_DATA', 'WE_CREATE_USR_UID', 'WE_UPDATE_USR_UID', 'WE_CREATE_DATE', 'WE_UPDATE_DATE', 'WE_TYPE', 'WE_CUSTOM_TITLE', 'WE_AUTHENTICATION', 'WE_HIDE_INFORMATION_BAR', 'WE_CALLBACK', 'WE_CALLBACK_URL', 'WE_LINK_GENERATION', 'WE_LINK_SKIN', 'WE_LINK_LANGUAGE', 'WE_LINK_DOMAIN', 'WE_SHOW_IN_NEW_CASE', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, ) ); /** @@ -121,10 +124,10 @@ abstract class BaseWebEntryPeer * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('WeUid' => 0, 'ProUid' => 1, 'TasUid' => 2, 'DynUid' => 3, 'UsrUid' => 4, 'WeMethod' => 5, 'WeInputDocumentAccess' => 6, 'WeData' => 7, 'WeCreateUsrUid' => 8, 'WeUpdateUsrUid' => 9, 'WeCreateDate' => 10, 'WeUpdateDate' => 11, 'WeType' => 12, 'WeCustomTitle' => 13, 'WeAuthentication' => 14, 'WeHideInformationBar' => 15, 'WeCallback' => 16, 'WeCallbackUrl' => 17, 'WeLinkGeneration' => 18, 'WeLinkSkin' => 19, 'WeLinkLanguage' => 20, 'WeLinkDomain' => 21, ), - BasePeer::TYPE_COLNAME => array (WebEntryPeer::WE_UID => 0, WebEntryPeer::PRO_UID => 1, WebEntryPeer::TAS_UID => 2, WebEntryPeer::DYN_UID => 3, WebEntryPeer::USR_UID => 4, WebEntryPeer::WE_METHOD => 5, WebEntryPeer::WE_INPUT_DOCUMENT_ACCESS => 6, WebEntryPeer::WE_DATA => 7, WebEntryPeer::WE_CREATE_USR_UID => 8, WebEntryPeer::WE_UPDATE_USR_UID => 9, WebEntryPeer::WE_CREATE_DATE => 10, WebEntryPeer::WE_UPDATE_DATE => 11, WebEntryPeer::WE_TYPE => 12, WebEntryPeer::WE_CUSTOM_TITLE => 13, WebEntryPeer::WE_AUTHENTICATION => 14, WebEntryPeer::WE_HIDE_INFORMATION_BAR => 15, WebEntryPeer::WE_CALLBACK => 16, WebEntryPeer::WE_CALLBACK_URL => 17, WebEntryPeer::WE_LINK_GENERATION => 18, WebEntryPeer::WE_LINK_SKIN => 19, WebEntryPeer::WE_LINK_LANGUAGE => 20, WebEntryPeer::WE_LINK_DOMAIN => 21, ), - BasePeer::TYPE_FIELDNAME => array ('WE_UID' => 0, 'PRO_UID' => 1, 'TAS_UID' => 2, 'DYN_UID' => 3, 'USR_UID' => 4, 'WE_METHOD' => 5, 'WE_INPUT_DOCUMENT_ACCESS' => 6, 'WE_DATA' => 7, 'WE_CREATE_USR_UID' => 8, 'WE_UPDATE_USR_UID' => 9, 'WE_CREATE_DATE' => 10, 'WE_UPDATE_DATE' => 11, 'WE_TYPE' => 12, 'WE_CUSTOM_TITLE' => 13, 'WE_AUTHENTICATION' => 14, 'WE_HIDE_INFORMATION_BAR' => 15, 'WE_CALLBACK' => 16, 'WE_CALLBACK_URL' => 17, 'WE_LINK_GENERATION' => 18, 'WE_LINK_SKIN' => 19, 'WE_LINK_LANGUAGE' => 20, 'WE_LINK_DOMAIN' => 21, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, ) + BasePeer::TYPE_PHPNAME => array ('WeUid' => 0, 'ProUid' => 1, 'TasUid' => 2, 'DynUid' => 3, 'UsrUid' => 4, 'WeMethod' => 5, 'WeInputDocumentAccess' => 6, 'WeData' => 7, 'WeCreateUsrUid' => 8, 'WeUpdateUsrUid' => 9, 'WeCreateDate' => 10, 'WeUpdateDate' => 11, 'WeType' => 12, 'WeCustomTitle' => 13, 'WeAuthentication' => 14, 'WeHideInformationBar' => 15, 'WeCallback' => 16, 'WeCallbackUrl' => 17, 'WeLinkGeneration' => 18, 'WeLinkSkin' => 19, 'WeLinkLanguage' => 20, 'WeLinkDomain' => 21, 'WeShowInNewCase' => 22, ), + BasePeer::TYPE_COLNAME => array (WebEntryPeer::WE_UID => 0, WebEntryPeer::PRO_UID => 1, WebEntryPeer::TAS_UID => 2, WebEntryPeer::DYN_UID => 3, WebEntryPeer::USR_UID => 4, WebEntryPeer::WE_METHOD => 5, WebEntryPeer::WE_INPUT_DOCUMENT_ACCESS => 6, WebEntryPeer::WE_DATA => 7, WebEntryPeer::WE_CREATE_USR_UID => 8, WebEntryPeer::WE_UPDATE_USR_UID => 9, WebEntryPeer::WE_CREATE_DATE => 10, WebEntryPeer::WE_UPDATE_DATE => 11, WebEntryPeer::WE_TYPE => 12, WebEntryPeer::WE_CUSTOM_TITLE => 13, WebEntryPeer::WE_AUTHENTICATION => 14, WebEntryPeer::WE_HIDE_INFORMATION_BAR => 15, WebEntryPeer::WE_CALLBACK => 16, WebEntryPeer::WE_CALLBACK_URL => 17, WebEntryPeer::WE_LINK_GENERATION => 18, WebEntryPeer::WE_LINK_SKIN => 19, WebEntryPeer::WE_LINK_LANGUAGE => 20, WebEntryPeer::WE_LINK_DOMAIN => 21, WebEntryPeer::WE_SHOW_IN_NEW_CASE => 22, ), + BasePeer::TYPE_FIELDNAME => array ('WE_UID' => 0, 'PRO_UID' => 1, 'TAS_UID' => 2, 'DYN_UID' => 3, 'USR_UID' => 4, 'WE_METHOD' => 5, 'WE_INPUT_DOCUMENT_ACCESS' => 6, 'WE_DATA' => 7, 'WE_CREATE_USR_UID' => 8, 'WE_UPDATE_USR_UID' => 9, 'WE_CREATE_DATE' => 10, 'WE_UPDATE_DATE' => 11, 'WE_TYPE' => 12, 'WE_CUSTOM_TITLE' => 13, 'WE_AUTHENTICATION' => 14, 'WE_HIDE_INFORMATION_BAR' => 15, 'WE_CALLBACK' => 16, 'WE_CALLBACK_URL' => 17, 'WE_LINK_GENERATION' => 18, 'WE_LINK_SKIN' => 19, 'WE_LINK_LANGUAGE' => 20, 'WE_LINK_DOMAIN' => 21, 'WE_SHOW_IN_NEW_CASE' => 22, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, ) ); /** @@ -269,6 +272,8 @@ abstract class BaseWebEntryPeer $criteria->addSelectColumn(WebEntryPeer::WE_LINK_DOMAIN); + $criteria->addSelectColumn(WebEntryPeer::WE_SHOW_IN_NEW_CASE); + } const COUNT = 'COUNT(WEB_ENTRY.WE_UID)'; diff --git a/workflow/engine/config/schema.xml b/workflow/engine/config/schema.xml index 837be11b5..cd8351ca3 100644 --- a/workflow/engine/config/schema.xml +++ b/workflow/engine/config/schema.xml @@ -3353,6 +3353,7 @@ + diff --git a/workflow/engine/data/mysql/schema.sql b/workflow/engine/data/mysql/schema.sql index dad4d9cbe..c336f3fc4 100644 --- a/workflow/engine/data/mysql/schema.sql +++ b/workflow/engine/data/mysql/schema.sql @@ -1671,6 +1671,7 @@ CREATE TABLE `WEB_ENTRY` `WE_LINK_SKIN` VARCHAR(255), `WE_LINK_LANGUAGE` VARCHAR(255), `WE_LINK_DOMAIN` MEDIUMTEXT, + `WE_SHOW_IN_NEW_CASE` CHAR(1) default '1', PRIMARY KEY (`WE_UID`) )ENGINE=InnoDB DEFAULT CHARSET='utf8'; #----------------------------------------------------------------------------- diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEvent.php b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEvent.php index 9d6693a6e..adf8a45bf 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEvent.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEvent.php @@ -1,22 +1,97 @@ array("type" => "string", "required" => false, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "webEntryEventUid"), + "WEE_UID" => array( + "type" => "string", + "required" => false, + "empty" => false, + "defaultValues" => array(), + "fieldNameAux" => "webEntryEventUid" + ), - "EVN_UID" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "eventUid"), - "ACT_UID" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "activityUid"), - "DYN_UID" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "dynaFormUid"), - "USR_UID" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "userUid"), + "EVN_UID" => array( + "type" => "string", + "required" => true, + "empty" => false, + "defaultValues" => array(), + "fieldNameAux" => "eventUid" + ), + "ACT_UID" => array( + "type" => "string", + "required" => true, + "empty" => false, + "defaultValues" => array(), + "fieldNameAux" => "activityUid" + ), + "DYN_UID" => array( + "type" => "string", + "required" => false, + "empty" => true, + "defaultValues" => array(), + "fieldNameAux" => "dynaFormUid" + ), + "USR_UID" => array( + "type" => "string", + "required" => false, + "empty" => true, + "defaultValues" => array(), + "fieldNameAux" => "userUid" + ), - "WEE_TITLE" => array("type" => "string", "required" => false, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "webEntryEventTitle"), - "WEE_DESCRIPTION" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "webEntryEventDescription"), - "WEE_STATUS" => array("type" => "string", "required" => false, "empty" => false, "defaultValues" => array("ENABLED", "DISABLED"), "fieldNameAux" => "webEntryEventStatus"), - "WE_LINK_SKIN" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "webEntryEventSkin"), - "WE_LINK_LANGUAGE" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "webEntryEventLanguage"), - "WE_LINK_DOMAIN" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "webEntryEventDomain"), + "WEE_TITLE" => array( + "type" => "string", + "required" => false, + "empty" => false, + "defaultValues" => array(), + "fieldNameAux" => "webEntryEventTitle" + ), + "WEE_DESCRIPTION" => array( + "type" => "string", + "required" => false, + "empty" => true, + "defaultValues" => array(), + "fieldNameAux" => "webEntryEventDescription" + ), + "WEE_STATUS" => array( + "type" => "string", + "required" => false, + "empty" => false, + "defaultValues" => array("ENABLED", "DISABLED"), + "fieldNameAux" => "webEntryEventStatus" + ), + "WE_LINK_SKIN" => array( + "type" => "string", + "required" => false, + "empty" => true, + "defaultValues" => array(), + "fieldNameAux" => "webEntryEventSkin" + ), + "WE_LINK_LANGUAGE" => array( + "type" => "string", + "required" => false, + "empty" => true, + "defaultValues" => array(), + "fieldNameAux" => "webEntryEventLanguage" + ), + "WE_LINK_DOMAIN" => array( + "type" => "string", + "required" => false, + "empty" => true, + "defaultValues" => array(), + "fieldNameAux" => "webEntryEventDomain" + ), ); private $formatFieldNameInUppercase = true; @@ -43,7 +118,7 @@ class WebEntryEvent foreach ($this->arrayFieldDefinition as $key => $value) { $this->arrayFieldNameForException[$value["fieldNameAux"]] = $key; } - } catch (\Exception $e) { + } catch (Exception $e) { throw $e; } } @@ -53,7 +128,8 @@ class WebEntryEvent * * @param bool $flag Value that set the format * - * return void + * @return void + * @throws Exception */ public function setFormatFieldNameInUppercase($flag) { @@ -63,7 +139,7 @@ class WebEntryEvent $this->formatFieldNameInUppercase = $flag; $this->setArrayFieldNameForException($this->arrayFieldNameForException); - } catch (\Exception $e) { + } catch (Exception $e) { throw $e; } } @@ -73,7 +149,8 @@ class WebEntryEvent * * @param array $arrayData Data with the fields * - * return void + * @return void + * @throws Exception */ public function setArrayFieldNameForException(array $arrayData) { @@ -83,7 +160,7 @@ class WebEntryEvent foreach ($arrayData as $key => $value) { $this->arrayFieldNameForException[$key] = $this->getFieldNameByFormatFieldName($value); } - } catch (\Exception $e) { + } catch (Exception $e) { throw $e; } } @@ -93,13 +170,14 @@ class WebEntryEvent * * @param string $fieldName Field name * - * return string Return the field name according the format + * @return string Return the field name according the format + * @throws Exception */ public function getFieldNameByFormatFieldName($fieldName) { try { - return ($this->formatFieldNameInUppercase)? strtoupper($fieldName) : strtolower($fieldName); - } catch (\Exception $e) { + return ($this->formatFieldNameInUppercase) ? strtoupper($fieldName) : strtolower($fieldName); + } catch (Exception $e) { throw $e; } } @@ -109,15 +187,16 @@ class WebEntryEvent * * @param string $webEntryEventUid Unique id of WebEntry-Event * - * return bool Return true if exists the WebEntry-Event, false otherwise + * @return bool Return true if exists the WebEntry-Event, false otherwise + * @throws Exception */ public function exists($webEntryEventUid) { try { - $obj = \WebEntryEventPeer::retrieveByPK($webEntryEventUid); + $obj = WebEntryEventPeer::retrieveByPK($webEntryEventUid); - return (!is_null($obj))? true : false; - } catch (\Exception $e) { + return (!is_null($obj)) ? true : false; + } catch (Exception $e) { throw $e; } } @@ -125,30 +204,31 @@ class WebEntryEvent /** * 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 $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 + * @return bool Return true if exists the Event of a WebEntry-Event, false otherwise + * @throws Exception */ public function existsEvent($projectUid, $eventUid, $webEntryEventUidToExclude = "") { try { - $criteria = new \Criteria("workflow"); + $criteria = new Criteria("workflow"); - $criteria->addSelectColumn(\WebEntryEventPeer::WEE_UID); - $criteria->add(\WebEntryEventPeer::PRJ_UID, $projectUid, \Criteria::EQUAL); + $criteria->addSelectColumn(WebEntryEventPeer::WEE_UID); + $criteria->add(WebEntryEventPeer::PRJ_UID, $projectUid, Criteria::EQUAL); if ($webEntryEventUidToExclude != "") { - $criteria->add(\WebEntryEventPeer::WEE_UID, $webEntryEventUidToExclude, \Criteria::NOT_EQUAL); + $criteria->add(WebEntryEventPeer::WEE_UID, $webEntryEventUidToExclude, Criteria::NOT_EQUAL); } - $criteria->add(\WebEntryEventPeer::EVN_UID, $eventUid, \Criteria::EQUAL); + $criteria->add(WebEntryEventPeer::EVN_UID, $eventUid, Criteria::EQUAL); - $rsCriteria = \WebEntryEventPeer::doSelectRS($criteria); + $rsCriteria = WebEntryEventPeer::doSelectRS($criteria); - return ($rsCriteria->next())? true : false; - } catch (\Exception $e) { + return ($rsCriteria->next()) ? true : false; + } catch (Exception $e) { throw $e; } } @@ -156,28 +236,29 @@ class WebEntryEvent /** * Verify if exists the title of a WebEntry-Event * - * @param string $projectUid Unique id of Project - * @param string $webEntryEventTitle Title + * @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 + * @return bool Return true if exists the title of a WebEntry-Event, false otherwise + * @throws Exception */ public function existsTitle($projectUid, $webEntryEventTitle, $webEntryEventUidToExclude = "") { try { - $criteria = new \Criteria("workflow"); + $criteria = new Criteria("workflow"); - $criteria->addSelectColumn(\WebEntryEventPeer::WEE_UID); - $criteria->add(\WebEntryEventPeer::PRJ_UID, $projectUid, \Criteria::EQUAL); + $criteria->addSelectColumn(WebEntryEventPeer::WEE_UID); + $criteria->add(WebEntryEventPeer::PRJ_UID, $projectUid, Criteria::EQUAL); if ($webEntryEventUidToExclude != "") { - $criteria->add(\WebEntryEventPeer::WEE_UID, $webEntryEventUidToExclude, \Criteria::NOT_EQUAL); + $criteria->add(WebEntryEventPeer::WEE_UID, $webEntryEventUidToExclude, Criteria::NOT_EQUAL); } - $criteria->add(\WebEntryEventPeer::WEE_TITLE, $webEntryEventTitle); - $rsCriteria = \WebEntryEventPeer::doSelectRS($criteria); + $criteria->add(WebEntryEventPeer::WEE_TITLE, $webEntryEventTitle); + $rsCriteria = WebEntryEventPeer::doSelectRS($criteria); - return ($rsCriteria->next())? true : false; - } catch (\Exception $e) { + return ($rsCriteria->next()) ? true : false; + } catch (Exception $e) { throw $e; } } @@ -185,18 +266,20 @@ class WebEntryEvent /** * Verify if does not exists the WebEntry-Event * - * @param string $webEntryEventUid Unique id of 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 + * @return void Throw exception if does not exists the WebEntry-Event + * @throws Exception */ public function throwExceptionIfNotExistsWebEntryEvent($webEntryEventUid, $fieldNameForException) { try { if (!$this->exists($webEntryEventUid)) { - throw new \Exception(\G::LoadTranslation("ID_WEB_ENTRY_EVENT_DOES_NOT_EXIST", array($fieldNameForException, $webEntryEventUid))); + throw new Exception(G::LoadTranslation("ID_WEB_ENTRY_EVENT_DOES_NOT_EXIST", + array($fieldNameForException, $webEntryEventUid))); } - } catch (\Exception $e) { + } catch (Exception $e) { throw $e; } } @@ -204,20 +287,26 @@ class WebEntryEvent /** * 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 $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 + * @return void Throw exception if is registered the Event + * @throws Exception */ - public function throwExceptionIfEventIsRegistered($projectUid, $eventUid, $fieldNameForException, $webEntryEventUidToExclude = "") - { + public function throwExceptionIfEventIsRegistered( + $projectUid, + $eventUid, + $fieldNameForException, + $webEntryEventUidToExclude = "" + ) { try { if ($this->existsEvent($projectUid, $eventUid, $webEntryEventUidToExclude)) { - throw new \Exception(\G::LoadTranslation("ID_WEB_ENTRY_EVENT_ALREADY_REGISTERED", array($fieldNameForException, $eventUid))); + throw new Exception(G::LoadTranslation("ID_WEB_ENTRY_EVENT_ALREADY_REGISTERED", + array($fieldNameForException, $eventUid))); } - } catch (\Exception $e) { + } catch (Exception $e) { throw $e; } } @@ -225,20 +314,26 @@ class WebEntryEvent /** * 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 $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 + * @return void Throw exception if exists the title of a WebEntry-Event + * @throws Exception */ - public function throwExceptionIfExistsTitle($projectUid, $webEntryEventTitle, $fieldNameForException, $webEntryEventUidToExclude = "") - { + public function throwExceptionIfExistsTitle( + $projectUid, + $webEntryEventTitle, + $fieldNameForException, + $webEntryEventUidToExclude = "" + ) { try { if ($this->existsTitle($projectUid, $webEntryEventTitle, $webEntryEventUidToExclude)) { - throw new \Exception(\G::LoadTranslation("ID_WEB_ENTRY_EVENT_TITLE_ALREADY_EXISTS", array($fieldNameForException, $webEntryEventTitle))); + throw new Exception(G::LoadTranslation("ID_WEB_ENTRY_EVENT_TITLE_ALREADY_EXISTS", + array($fieldNameForException, $webEntryEventTitle))); } - } catch (\Exception $e) { + } catch (Exception $e) { throw $e; } } @@ -247,17 +342,19 @@ class WebEntryEvent * 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 + * @param string $projectUid Unique id of Project + * @param array $arrayData Data * - * return void Throw exception if data has an invalid value + * @return void Throw exception if data has an invalid value + * @throws Exception */ public function throwExceptionIfDataIsInvalid($webEntryEventUid, $projectUid, array $arrayData) { try { //Set variables - $arrayWebEntryEventData = ($webEntryEventUid == "")? array() : $this->getWebEntryEvent($webEntryEventUid, true); - $flagInsert = ($webEntryEventUid == "")? true : false; + $arrayWebEntryEventData = ($webEntryEventUid == "") ? array() : $this->getWebEntryEvent($webEntryEventUid, + true); + $flagInsert = ($webEntryEventUid == "") ? true : false; $arrayFinalData = array_merge($arrayWebEntryEventData, $arrayData); @@ -294,71 +391,79 @@ class WebEntryEvent $this->arrayFieldDefinition['WE_LINK_LANGUAGE']['defaultValues'] = $languages; } - $process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, $flagInsert); + $process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, + $this->arrayFieldNameForException, $flagInsert); //Verify data if (isset($arrayData["EVN_UID"])) { - $this->throwExceptionIfEventIsRegistered($projectUid, $arrayData["EVN_UID"], $this->arrayFieldNameForException["eventUid"], $webEntryEventUid); + $this->throwExceptionIfEventIsRegistered($projectUid, $arrayData["EVN_UID"], + $this->arrayFieldNameForException["eventUid"], $webEntryEventUid); } if (isset($arrayData["EVN_UID"])) { $obj = \BpmnEventPeer::retrieveByPK($arrayData["EVN_UID"]); if (is_null($obj)) { - throw new \Exception(\G::LoadTranslation("ID_EVENT_NOT_EXIST", array($this->arrayFieldNameForException["eventUid"], $arrayData["EVN_UID"]))); + throw new Exception(G::LoadTranslation("ID_EVENT_NOT_EXIST", + array($this->arrayFieldNameForException["eventUid"], $arrayData["EVN_UID"]))); } if (($obj->getEvnType() != "START") || ($obj->getEvnType() == "START" && $obj->getEvnMarker() != "EMPTY")) { - throw new \Exception(\G::LoadTranslation("ID_EVENT_NOT_IS_START_EVENT", array($this->arrayFieldNameForException["eventUid"], $arrayData["EVN_UID"]))); + throw new Exception(G::LoadTranslation("ID_EVENT_NOT_IS_START_EVENT", + array($this->arrayFieldNameForException["eventUid"], $arrayData["EVN_UID"]))); } } if (isset($arrayData["WEE_TITLE"])) { - $this->throwExceptionIfExistsTitle($projectUid, $arrayData["WEE_TITLE"], $this->arrayFieldNameForException["webEntryEventTitle"], $webEntryEventUid); + $this->throwExceptionIfExistsTitle($projectUid, $arrayData["WEE_TITLE"], + $this->arrayFieldNameForException["webEntryEventTitle"], $webEntryEventUid); } if (isset($arrayData["ACT_UID"])) { $bpmn = new \ProcessMaker\Project\Bpmn(); if (!$bpmn->activityExists($arrayData["ACT_UID"])) { - throw new \Exception(\G::LoadTranslation("ID_ACTIVITY_DOES_NOT_EXIST", array($this->arrayFieldNameForException["activityUid"], $arrayData["ACT_UID"]))); + throw new Exception(G::LoadTranslation("ID_ACTIVITY_DOES_NOT_EXIST", + array($this->arrayFieldNameForException["activityUid"], $arrayData["ACT_UID"]))); } } if (isset($arrayData["EVN_UID"]) || isset($arrayData["ACT_UID"])) { - $criteria = new \Criteria("workflow"); + $criteria = new Criteria("workflow"); - $criteria->addSelectColumn(\BpmnFlowPeer::FLO_UID); - $criteria->add(\BpmnFlowPeer::FLO_ELEMENT_ORIGIN, $arrayFinalData["EVN_UID"], \Criteria::EQUAL); - $criteria->add(\BpmnFlowPeer::FLO_ELEMENT_ORIGIN_TYPE, "bpmnEvent", \Criteria::EQUAL); - $criteria->add(\BpmnFlowPeer::FLO_ELEMENT_DEST, $arrayFinalData["ACT_UID"], \Criteria::EQUAL); - $criteria->add(\BpmnFlowPeer::FLO_ELEMENT_DEST_TYPE, "bpmnActivity", \Criteria::EQUAL); + $criteria->addSelectColumn(BpmnFlowPeer::FLO_UID); + $criteria->add(BpmnFlowPeer::FLO_ELEMENT_ORIGIN, $arrayFinalData["EVN_UID"], Criteria::EQUAL); + $criteria->add(BpmnFlowPeer::FLO_ELEMENT_ORIGIN_TYPE, "bpmnEvent", Criteria::EQUAL); + $criteria->add(BpmnFlowPeer::FLO_ELEMENT_DEST, $arrayFinalData["ACT_UID"], Criteria::EQUAL); + $criteria->add(BpmnFlowPeer::FLO_ELEMENT_DEST_TYPE, "bpmnActivity", Criteria::EQUAL); - $rsCriteria = \BpmnFlowPeer::doSelectRS($criteria); + $rsCriteria = BpmnFlowPeer::doSelectRS($criteria); if (!$rsCriteria->next()) { - throw new \Exception(\G::LoadTranslation("ID_WEB_ENTRY_EVENT_FLOW_EVENT_TO_ACTIVITY_DOES_NOT_EXIST")); + throw new Exception(G::LoadTranslation("ID_WEB_ENTRY_EVENT_FLOW_EVENT_TO_ACTIVITY_DOES_NOT_EXIST")); } } if (!empty($arrayData["DYN_UID"])) { $dynaForm = new \ProcessMaker\BusinessModel\DynaForm(); - $dynaForm->throwExceptionIfNotExistsDynaForm($arrayData["DYN_UID"], $projectUid, $this->arrayFieldNameForException["dynaFormUid"]); + $dynaForm->throwExceptionIfNotExistsDynaForm($arrayData["DYN_UID"], $projectUid, + $this->arrayFieldNameForException["dynaFormUid"]); } if (!empty($arrayData["USR_UID"])) { - $process->throwExceptionIfNotExistsUser($arrayData["USR_UID"], $this->arrayFieldNameForException["userUid"]); + $process->throwExceptionIfNotExistsUser($arrayData["USR_UID"], + $this->arrayFieldNameForException["userUid"]); } - + if ($arrayData["WE_TYPE"] === "SINGLE" && empty($arrayData["DYN_UID"])) { - throw new \Exception(\G::LoadTranslation("ID_SELECT_DYNAFORM_USE_IN_CASE")); + throw new Exception(G::LoadTranslation("ID_SELECT_DYNAFORM_USE_IN_CASE")); } if ($arrayData["WE_CALLBACK"] === "CUSTOM" && empty($arrayData["WE_CALLBACK_URL"])) { - throw new \Exception(\G::LoadTranslation("ID_ENTER_VALID_URL")); + throw new Exception(G::LoadTranslation("ID_ENTER_VALID_URL")); } - } catch (\Exception $e) { + } catch (Exception $e) { throw $e; } } @@ -372,25 +477,36 @@ class WebEntryEvent public static function getTaskUidFromEvnUid($eventUid) { $prefix = "wee-"; + return $prefix . substr($eventUid, (32 - strlen($prefix)) * -1); } /** * 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 $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 + * @return void + * @throws Exception */ - public function createWebEntry($projectUid, $eventUid, $activityUid, $dynaFormUid, $userUid, $title, $description, $userUidCreator, $arrayData=[]) - { + public function createWebEntry( + $projectUid, + $eventUid, + $activityUid, + $dynaFormUid, + $userUid, + $title, + $description, + $userUidCreator, + $arrayData = [] + ) { try { $bpmn = new \ProcessMaker\Project\Bpmn(); @@ -406,30 +522,39 @@ class WebEntryEvent } else { $this->webEntryEventWebEntryTaskUid = $task->create( array( - "TAS_UID" => $tasUid, - "PRO_UID" => $projectUid, - "TAS_TYPE" => "WEBENTRYEVENT", + "TAS_UID" => $tasUid, + "PRO_UID" => $projectUid, + "TAS_TYPE" => "WEBENTRYEVENT", "TAS_TITLE" => "WEBENTRYEVENT", "TAS_START" => "TRUE", - "TAS_POSX" => (int)($arrayEventData["BOU_X"]), - "TAS_POSY" => (int)($arrayEventData["BOU_Y"]) + "TAS_POSX" => (int)($arrayEventData["BOU_X"]), + "TAS_POSY" => (int)($arrayEventData["BOU_Y"]) ), false ); - if (!isset($arrayData['WE_TYPE']) || $arrayData['WE_TYPE']==='SINGLE') { + if (!isset($arrayData['WE_TYPE']) || $arrayData['WE_TYPE'] === 'SINGLE') { //Task - Step $step = new \Step(); - $stepUid = $step->create(array("PRO_UID" => $projectUid, "TAS_UID" => $this->webEntryEventWebEntryTaskUid)); + $stepUid = $step->create(array( + "PRO_UID" => $projectUid, + "TAS_UID" => $this->webEntryEventWebEntryTaskUid + )); if (!empty($dynaFormUid)) { - $result = $step->update(array("STEP_UID" => $stepUid, "STEP_TYPE_OBJ" => "DYNAFORM", "STEP_UID_OBJ" => $dynaFormUid, "STEP_POSITION" => 1, "STEP_MODE" => "EDIT")); + $result = $step->update(array( + "STEP_UID" => $stepUid, + "STEP_TYPE_OBJ" => "DYNAFORM", + "STEP_UID_OBJ" => $dynaFormUid, + "STEP_POSITION" => 1, + "STEP_MODE" => "EDIT" + )); } } //Task - User $task = new \Tasks(); - if (!(isset($arrayData['WE_AUTHENTICATION']) && $arrayData['WE_AUTHENTICATION']==='LOGIN_REQUIRED')) { + if (!(isset($arrayData['WE_AUTHENTICATION']) && $arrayData['WE_AUTHENTICATION'] === 'LOGIN_REQUIRED')) { $task->assignUser($this->webEntryEventWebEntryTaskUid, $userUid, 1); } @@ -440,8 +565,8 @@ class WebEntryEvent } //WebEntry - if (isset($arrayData['WE_LINK_GENERATION']) && $arrayData['WE_LINK_GENERATION']==='ADVANCED') { - $arrayData['WE_DATA'] = isset($arrayData['WEE_URL'])?$arrayData['WEE_URL']:null; + if (isset($arrayData['WE_LINK_GENERATION']) && $arrayData['WE_LINK_GENERATION'] === 'ADVANCED') { + $arrayData['WE_DATA'] = isset($arrayData['WEE_URL']) ? $arrayData['WEE_URL'] : null; } $data0 = []; foreach ($arrayData as $k => $v) { @@ -457,20 +582,21 @@ class WebEntryEvent 'WE_LINK_SKIN', 'WE_LINK_LANGUAGE', 'WE_LINK_DOMAIN', + 'WE_SHOW_IN_NEW_CASE', ]); if ($exists !== false) { $data0[$k] = $v; } } $data = array_merge($data0, 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 - )); + "TAS_UID" => $this->webEntryEventWebEntryTaskUid, + "DYN_UID" => $dynaFormUid, + "USR_UID" => $userUid, + "WE_TITLE" => $title, + "WE_DESCRIPTION" => $description, + "WE_METHOD" => "WS", + "WE_INPUT_DOCUMENT_ACCESS" => 1 + )); $arrayWebEntryData = $this->webEntry->create( $projectUid, $userUidCreator, @@ -478,7 +604,7 @@ class WebEntryEvent ); $this->webEntryEventWebEntryUid = $arrayWebEntryData[$this->getFieldNameByFormatFieldName("WE_UID")]; - } catch (\Exception $e) { + } catch (Exception $e) { throw $e; } } @@ -486,10 +612,11 @@ class WebEntryEvent /** * Delete WebEntry * - * @param string $webEntryUid Unique id of WebEntry + * @param string $webEntryUid Unique id of WebEntry * @param string $webEntryTaskUid WebEntry, unique id of Task * - * return void + * @return void + * @throws Exception */ public function deleteWebEntry($webEntryUid, $webEntryTaskUid) { @@ -505,13 +632,13 @@ class WebEntryEvent } if ($webEntryUid != "") { - $obj = \WebEntryPeer::retrieveByPK($webEntryUid); + $obj = WebEntryPeer::retrieveByPK($webEntryUid); if (!is_null($obj)) { $this->webEntry->delete($webEntryUid); } } - } catch (\Exception $e) { + } catch (Exception $e) { throw $e; } } @@ -519,11 +646,12 @@ class WebEntryEvent /** * Create WebEntry-Event for a Project * - * @param string $projectUid Unique id of Project + * @param string $projectUid Unique id of Project * @param string $userUidCreator Unique id of creator User - * @param array $arrayData Data + * @param array $arrayData Data * - * return array Return data of the new WebEntry-Event created + * @return array Return data of the new WebEntry-Event created + * @throws Exception */ public function create($projectUid, $userUidCreator, array $arrayData) { @@ -582,7 +710,7 @@ class WebEntryEvent $projectUid, $arrayData["EVN_UID"], $arrayData["ACT_UID"], - empty($arrayData["DYN_UID"])?null:$arrayData["DYN_UID"], + empty($arrayData["DYN_UID"]) ? null : $arrayData["DYN_UID"], $arrayData["USR_UID"], $arrayData["WEE_TITLE"], $arrayData["WEE_DESCRIPTION"], @@ -611,12 +739,14 @@ class WebEntryEvent //Set WEE_TITLE if (isset($arrayData["WEE_TITLE"])) { - $result = \Content::addContent("WEE_TITLE", "", $webEntryEventUid, SYS_LANG, $arrayData["WEE_TITLE"]); + $result = \Content::addContent("WEE_TITLE", "", $webEntryEventUid, SYS_LANG, + $arrayData["WEE_TITLE"]); } //Set WEE_DESCRIPTION if (isset($arrayData["WEE_DESCRIPTION"])) { - $result = \Content::addContent("WEE_DESCRIPTION", "", $webEntryEventUid, SYS_LANG, $arrayData["WEE_DESCRIPTION"]); + $result = \Content::addContent("WEE_DESCRIPTION", "", $webEntryEventUid, SYS_LANG, + $arrayData["WEE_DESCRIPTION"]); } //Return @@ -625,19 +755,19 @@ class WebEntryEvent $msg = ""; foreach ($webEntryEvent->getValidationFailures() as $validationFailure) { - $msg = $msg . (($msg != "")? "\n" : "") . $validationFailure->getMessage(); + $msg = $msg . (($msg != "") ? "\n" : "") . $validationFailure->getMessage(); } - throw new \Exception(\G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . (($msg != "")? "\n" . $msg : "")); + throw new Exception(G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . (($msg != "") ? "\n" . $msg : "")); } - } catch (\Exception $e) { + } catch (Exception $e) { $cnn->rollback(); $this->deleteWebEntry($this->webEntryEventWebEntryUid, $this->webEntryEventWebEntryTaskUid); throw $e; } - } catch (\Exception $e) { + } catch (Exception $e) { throw $e; } } @@ -646,10 +776,11 @@ class WebEntryEvent * Update WebEntry-Event * * @param string $webEntryEventUid Unique id of WebEntry-Event - * @param string $userUidUpdater Unique id of updater User - * @param array $arrayData Data + * @param string $userUidUpdater Unique id of updater User + * @param array $arrayData Data * - * return array Return data of the WebEntry-Event updated + * @return array Return data of the WebEntry-Event updated + * @throws Exception */ public function update($webEntryEventUid, $userUidUpdater, array $arrayData) { @@ -676,7 +807,8 @@ class WebEntryEvent $arrayFinalData = array_merge($arrayWebEntryEventData, $arrayData); //Verify data - $this->throwExceptionIfNotExistsWebEntryEvent($webEntryEventUid, $this->arrayFieldNameForException["webEntryEventUid"]); + $this->throwExceptionIfNotExistsWebEntryEvent($webEntryEventUid, + $this->arrayFieldNameForException["webEntryEventUid"]); $this->throwExceptionIfDataIsInvalid($webEntryEventUid, $arrayWebEntryEventData["PRJ_UID"], $arrayData); @@ -693,11 +825,11 @@ class WebEntryEvent //Task - Step for WE_TYPE=SINGLE $weType = !empty($arrayData["WE_TYPE"]) ? $arrayData["WE_TYPE"] : $arrayWebEntryEventData["WE_TYPE"]; - if (isset($arrayData["DYN_UID"]) && $arrayData["DYN_UID"] !== $arrayWebEntryEventData["DYN_UID"] && $weType==='SINGLE') { + if (isset($arrayData["DYN_UID"]) && $arrayData["DYN_UID"] !== $arrayWebEntryEventData["DYN_UID"] && $weType === 'SINGLE') { //Delete $step = new \Step(); - $criteria = new \Criteria("workflow"); + $criteria = new Criteria("workflow"); $criteria->add(\StepPeer::TAS_UID, $arrayWebEntryEventData["WEE_WE_TAS_UID"]); @@ -713,8 +845,17 @@ class WebEntryEvent //Add $step = new \Step(); - $stepUid = $step->create(array("PRO_UID" => $arrayWebEntryEventData["PRJ_UID"], "TAS_UID" => $arrayWebEntryEventData["WEE_WE_TAS_UID"])); - $result = $step->update(array("STEP_UID" => $stepUid, "STEP_TYPE_OBJ" => "DYNAFORM", "STEP_UID_OBJ" => $arrayData["DYN_UID"], "STEP_POSITION" => 1, "STEP_MODE" => "EDIT")); + $stepUid = $step->create(array( + "PRO_UID" => $arrayWebEntryEventData["PRJ_UID"], + "TAS_UID" => $arrayWebEntryEventData["WEE_WE_TAS_UID"] + )); + $result = $step->update(array( + "STEP_UID" => $stepUid, + "STEP_TYPE_OBJ" => "DYNAFORM", + "STEP_UID_OBJ" => $arrayData["DYN_UID"], + "STEP_POSITION" => 1, + "STEP_MODE" => "EDIT" + )); } //Task - User @@ -722,7 +863,7 @@ class WebEntryEvent //Unassign $taskUser = new \TaskUser(); - $criteria = new \Criteria("workflow"); + $criteria = new Criteria("workflow"); $criteria->add(\TaskUserPeer::TAS_UID, $arrayWebEntryEventData["WEE_WE_TAS_UID"]); @@ -732,11 +873,13 @@ class WebEntryEvent while ($rsCriteria->next()) { $row = $rsCriteria->getRow(); - $result = $taskUser->remove($row["TAS_UID"], $row["USR_UID"], $row["TU_TYPE"], $row["TU_RELATION"]); + $result = $taskUser->remove($row["TAS_UID"], $row["USR_UID"], $row["TU_TYPE"], + $row["TU_RELATION"]); } //Assign - $result = $task->assignUser($arrayWebEntryEventData["WEE_WE_TAS_UID"], $arrayData["USR_UID"], 1); + $result = $task->assignUser($arrayWebEntryEventData["WEE_WE_TAS_UID"], $arrayData["USR_UID"], + 1); } //Route @@ -751,7 +894,8 @@ class WebEntryEvent //Add $workflow = \ProcessMaker\Project\Workflow::load($arrayWebEntryEventData["PRJ_UID"]); - $result = $workflow->addRoute($arrayWebEntryEventData["WEE_WE_TAS_UID"], $arrayData["ACT_UID"], "SEQUENTIAL"); + $result = $workflow->addRoute($arrayWebEntryEventData["WEE_WE_TAS_UID"], $arrayData["ACT_UID"], + "SEQUENTIAL"); } //WebEntry @@ -772,20 +916,22 @@ class WebEntryEvent 'WE_LINK_LANGUAGE' => 'WE_LINK_LANGUAGE', 'WE_LINK_DOMAIN' => 'WE_LINK_DOMAIN', 'WE_DATA' => 'WEE_URL', + 'WE_SHOW_IN_NEW_CASE' => 'WE_SHOW_IN_NEW_CASE', ]; foreach ($webEntryMap as $k => $v) { if (array_key_exists($v, $arrayData)) { - $arrayDataAux[$k] = $arrayData[$v]; + $arrayDataAux[$k] = $arrayData[$v]; } } if (count($arrayDataAux) > 0) { - $arrayDataAux = $this->webEntry->update($arrayWebEntryEventData["WEE_WE_UID"], $userUidUpdater, $arrayDataAux); + $arrayDataAux = $this->webEntry->update($arrayWebEntryEventData["WEE_WE_UID"], $userUidUpdater, + $arrayDataAux); } } //WebEntry-Event - $webEntryEvent = \WebEntryEventPeer::retrieveByPK($webEntryEventUid); + $webEntryEvent = WebEntryEventPeer::retrieveByPK($webEntryEventUid); $webEntryEvent->fromArray($arrayData, \BasePeer::TYPE_FIELDNAME); @@ -798,12 +944,14 @@ class WebEntryEvent //Set WEE_TITLE if (isset($arrayData["WEE_TITLE"])) { - $result = \Content::addContent("WEE_TITLE", "", $webEntryEventUid, SYS_LANG, $arrayData["WEE_TITLE"]); + $result = \Content::addContent("WEE_TITLE", "", $webEntryEventUid, SYS_LANG, + $arrayData["WEE_TITLE"]); } //Set WEE_DESCRIPTION if (isset($arrayData["WEE_DESCRIPTION"])) { - $result = \Content::addContent("WEE_DESCRIPTION", "", $webEntryEventUid, SYS_LANG, $arrayData["WEE_DESCRIPTION"]); + $result = \Content::addContent("WEE_DESCRIPTION", "", $webEntryEventUid, SYS_LANG, + $arrayData["WEE_DESCRIPTION"]); } //Return @@ -818,19 +966,19 @@ class WebEntryEvent $msg = ""; foreach ($webEntryEvent->getValidationFailures() as $validationFailure) { - $msg = $msg . (($msg != "")? "\n" : "") . $validationFailure->getMessage(); + $msg = $msg . (($msg != "") ? "\n" : "") . $validationFailure->getMessage(); } - throw new \Exception(\G::LoadTranslation("ID_REGISTRY_CANNOT_BE_UPDATED") . (($msg != "")? "\n" . $msg : "")); + throw new Exception(G::LoadTranslation("ID_REGISTRY_CANNOT_BE_UPDATED") . (($msg != "") ? "\n" . $msg : "")); } - } catch (\Exception $e) { + } catch (Exception $e) { $cnn->rollback(); $this->deleteWebEntry($this->webEntryEventWebEntryUid, $this->webEntryEventWebEntryTaskUid); throw $e; } - } catch (\Exception $e) { + } catch (Exception $e) { throw $e; } } @@ -840,13 +988,15 @@ class WebEntryEvent * * @param string $webEntryEventUid Unique id of WebEntry-Event * - * return void + * @return void + * @throws Exception */ public function delete($webEntryEventUid) { try { //Verify data - $this->throwExceptionIfNotExistsWebEntryEvent($webEntryEventUid, $this->arrayFieldNameForException["webEntryEventUid"]); + $this->throwExceptionIfNotExistsWebEntryEvent($webEntryEventUid, + $this->arrayFieldNameForException["webEntryEventUid"]); //Set variables $arrayWebEntryEventData = $this->getWebEntryEvent($webEntryEventUid, true); @@ -855,56 +1005,58 @@ class WebEntryEvent $this->deleteWebEntry($arrayWebEntryEventData["WEE_WE_UID"], $arrayWebEntryEventData["WEE_WE_TAS_UID"]); //Delete WebEntry-Event - $criteria = new \Criteria("workflow"); + $criteria = new Criteria("workflow"); - $criteria->add(\WebEntryEventPeer::WEE_UID, $webEntryEventUid, \Criteria::EQUAL); + $criteria->add(WebEntryEventPeer::WEE_UID, $webEntryEventUid, Criteria::EQUAL); - $result = \WebEntryEventPeer::doDelete($criteria); - } catch (\Exception $e) { + $result = WebEntryEventPeer::doDelete($criteria); + } catch (Exception $e) { throw $e; } } /** * Get criteria for WebEntry-Event - * + * * @category webentry2,PROD-181,webentry1 * @link https://processmaker.atlassian.net/browse/PROD-181 Web Entry 2 Feature definition * @link URL description https://processmaker.atlassian.net/browse/PROD-1 Web Entry 1 Feature definition * @group webentry2 - * @return \Criteria - * @throws \Exception + * @return Criteria + * @throws Exception */ public function getWebEntryEventCriteria() { try { - $criteria = new \Criteria("workflow"); - $criteria->addSelectColumn(\WebEntryEventPeer::WEE_UID); - $criteria->addSelectColumn(\WebEntryEventPeer::PRJ_UID); - $criteria->addSelectColumn(\WebEntryEventPeer::EVN_UID); - $criteria->addSelectColumn(\WebEntryEventPeer::ACT_UID); - $criteria->addSelectColumn(\WebEntryEventPeer::DYN_UID); - $criteria->addSelectColumn(\WebEntryEventPeer::USR_UID); - $criteria->addSelectColumn(\WebEntryEventPeer::WEE_TITLE); - $criteria->addSelectColumn(\WebEntryEventPeer::WEE_DESCRIPTION); - $criteria->addSelectColumn(\WebEntryEventPeer::WEE_STATUS); - $criteria->addSelectColumn(\WebEntryEventPeer::WEE_WE_UID); - $criteria->addSelectColumn(\WebEntryEventPeer::WEE_WE_TAS_UID); - $criteria->addSelectColumn(\WebEntryPeer::WE_DATA . " AS WEE_WE_URL"); - $criteria->addSelectColumn(\WebEntryPeer::WE_CUSTOM_TITLE); - $criteria->addSelectColumn(\WebEntryPeer::WE_TYPE); - $criteria->addSelectColumn(\WebEntryPeer::WE_AUTHENTICATION); - $criteria->addSelectColumn(\WebEntryPeer::WE_HIDE_INFORMATION_BAR); - $criteria->addSelectColumn(\WebEntryPeer::WE_CALLBACK); - $criteria->addSelectColumn(\WebEntryPeer::WE_CALLBACK_URL); - $criteria->addSelectColumn(\WebEntryPeer::WE_LINK_GENERATION); - $criteria->addSelectColumn(\WebEntryPeer::WE_LINK_SKIN); - $criteria->addSelectColumn(\WebEntryPeer::WE_LINK_LANGUAGE); - $criteria->addSelectColumn(\WebEntryPeer::WE_LINK_DOMAIN); - $criteria->addSelectColumn(\WebEntryPeer::TAS_UID); - $criteria->addJoin(\WebEntryEventPeer::WEE_WE_UID, \WebEntryPeer::WE_UID, \Criteria::LEFT_JOIN); + $criteria = new Criteria("workflow"); + $criteria->addSelectColumn(WebEntryEventPeer::WEE_UID); + $criteria->addSelectColumn(WebEntryEventPeer::PRJ_UID); + $criteria->addSelectColumn(WebEntryEventPeer::EVN_UID); + $criteria->addSelectColumn(WebEntryEventPeer::ACT_UID); + $criteria->addSelectColumn(WebEntryEventPeer::DYN_UID); + $criteria->addSelectColumn(WebEntryEventPeer::USR_UID); + $criteria->addSelectColumn(WebEntryEventPeer::WEE_TITLE); + $criteria->addSelectColumn(WebEntryEventPeer::WEE_DESCRIPTION); + $criteria->addSelectColumn(WebEntryEventPeer::WEE_STATUS); + $criteria->addSelectColumn(WebEntryEventPeer::WEE_WE_UID); + $criteria->addSelectColumn(WebEntryEventPeer::WEE_WE_TAS_UID); + $criteria->addSelectColumn(WebEntryPeer::WE_DATA . " AS WEE_WE_URL"); + $criteria->addSelectColumn(WebEntryPeer::WE_CUSTOM_TITLE); + $criteria->addSelectColumn(WebEntryPeer::WE_TYPE); + $criteria->addSelectColumn(WebEntryPeer::WE_AUTHENTICATION); + $criteria->addSelectColumn(WebEntryPeer::WE_HIDE_INFORMATION_BAR); + $criteria->addSelectColumn(WebEntryPeer::WE_CALLBACK); + $criteria->addSelectColumn(WebEntryPeer::WE_CALLBACK_URL); + $criteria->addSelectColumn(WebEntryPeer::WE_LINK_GENERATION); + $criteria->addSelectColumn(WebEntryPeer::WE_LINK_SKIN); + $criteria->addSelectColumn(WebEntryPeer::WE_LINK_LANGUAGE); + $criteria->addSelectColumn(WebEntryPeer::WE_LINK_DOMAIN); + $criteria->addSelectColumn(WebEntryPeer::TAS_UID); + $criteria->addSelectColumn(WebEntryPeer::WE_SHOW_IN_NEW_CASE); + $criteria->addJoin(WebEntryEventPeer::WEE_WE_UID, WebEntryPeer::WE_UID, Criteria::LEFT_JOIN); + return $criteria; - } catch (\Exception $e) { + } catch (Exception $e) { throw $e; } } @@ -914,12 +1066,13 @@ class WebEntryEvent * * @param array $record Record * - * return array Return an array with data WebEntry-Event + * @return array Return an array with data WebEntry-Event + * @throws Exception */ public function getWebEntryEventDataFromRecord(array $record) { try { - if ($record["WEE_WE_UID"]."" != "") { + if ($record["WEE_WE_UID"] . "" != "") { $record["WEE_WE_URL"] = $this->getGeneratedLink( $record["WEE_UID"], $record["PRJ_UID"], $record["WE_LINK_GENERATION"], $record["WE_LINK_DOMAIN"], @@ -929,28 +1082,29 @@ class WebEntryEvent } 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_STATUS") => $record["WEE_STATUS"]."", - $this->getFieldNameByFormatFieldName("WEE_URL") => $record["WEE_WE_URL"]."", - $this->getFieldNameByFormatFieldName("WE_TYPE") => $record["WE_TYPE"], - $this->getFieldNameByFormatFieldName("WE_CUSTOM_TITLE") => $record["WE_CUSTOM_TITLE"], - $this->getFieldNameByFormatFieldName("WE_AUTHENTICATION") => $record["WE_AUTHENTICATION"], + $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_STATUS") => $record["WEE_STATUS"] . "", + $this->getFieldNameByFormatFieldName("WEE_URL") => $record["WEE_WE_URL"] . "", + $this->getFieldNameByFormatFieldName("WE_TYPE") => $record["WE_TYPE"], + $this->getFieldNameByFormatFieldName("WE_CUSTOM_TITLE") => $record["WE_CUSTOM_TITLE"], + $this->getFieldNameByFormatFieldName("WE_AUTHENTICATION") => $record["WE_AUTHENTICATION"], $this->getFieldNameByFormatFieldName("WE_HIDE_INFORMATION_BAR") => $record["WE_HIDE_INFORMATION_BAR"], - $this->getFieldNameByFormatFieldName("WE_CALLBACK") => $record["WE_CALLBACK"], - $this->getFieldNameByFormatFieldName("WE_CALLBACK_URL") => $record["WE_CALLBACK_URL"], - $this->getFieldNameByFormatFieldName("WE_LINK_GENERATION") => $record["WE_LINK_GENERATION"], - $this->getFieldNameByFormatFieldName("WE_LINK_SKIN") => $record["WE_LINK_SKIN"], - $this->getFieldNameByFormatFieldName("WE_LINK_LANGUAGE") => $record["WE_LINK_LANGUAGE"], - $this->getFieldNameByFormatFieldName("WE_LINK_DOMAIN") => $record["WE_LINK_DOMAIN"], - $this->getFieldNameByFormatFieldName("TAS_UID") => $record["TAS_UID"], + $this->getFieldNameByFormatFieldName("WE_CALLBACK") => $record["WE_CALLBACK"], + $this->getFieldNameByFormatFieldName("WE_CALLBACK_URL") => $record["WE_CALLBACK_URL"], + $this->getFieldNameByFormatFieldName("WE_LINK_GENERATION") => $record["WE_LINK_GENERATION"], + $this->getFieldNameByFormatFieldName("WE_LINK_SKIN") => $record["WE_LINK_SKIN"], + $this->getFieldNameByFormatFieldName("WE_LINK_LANGUAGE") => $record["WE_LINK_LANGUAGE"], + $this->getFieldNameByFormatFieldName("WE_LINK_DOMAIN") => $record["WE_LINK_DOMAIN"], + $this->getFieldNameByFormatFieldName("WE_SHOW_IN_NEW_CASE") => $record["WE_SHOW_IN_NEW_CASE"], + $this->getFieldNameByFormatFieldName("TAS_UID") => $record["TAS_UID"], ); - } catch (\Exception $e) { + } catch (Exception $e) { throw $e; } } @@ -960,7 +1114,8 @@ class WebEntryEvent * * @param string $projectUid Unique id of Project * - * return array Return an array with all WebEntry-Events + * @return array Return an array with all WebEntry-Events + * @throws Exception */ public function getWebEntryEvents($projectUid) { @@ -975,9 +1130,9 @@ class WebEntryEvent //Get data $criteria = $this->getWebEntryEventCriteria(); - $criteria->add(\WebEntryEventPeer::PRJ_UID, $projectUid, \Criteria::EQUAL); + $criteria->add(WebEntryEventPeer::PRJ_UID, $projectUid, Criteria::EQUAL); - $rsCriteria = \WebEntryEventPeer::doSelectRS($criteria); + $rsCriteria = WebEntryEventPeer::doSelectRS($criteria); $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); while ($rsCriteria->next()) { @@ -988,7 +1143,7 @@ class WebEntryEvent //Return return $arrayWebEntryEvent; - } catch (\Exception $e) { + } catch (Exception $e) { throw $e; } } @@ -996,24 +1151,37 @@ class WebEntryEvent /** * Get all WebEntry-Events * Return an array with all WebEntry-Events + * @param boolean $considerShowInCase * @return array - * @throws \Exception + * @throws Exception */ - public function getAllWebEntryEvents() + public function getAllWebEntryEvents($considerShowInCase = false) { try { $result = array(); $criteria = $this->getWebEntryEventCriteria(); - $criteria->addJoin(\WebEntryEventPeer::PRJ_UID, \ProcessPeer::PRO_UID, \Criteria::JOIN); - $criteria->add(\ProcessPeer::PRO_STATUS, 'ACTIVE', \Criteria::EQUAL); - $rsCriteria = \WebEntryEventPeer::doSelectRS($criteria); + $criteria->addJoin( + WebEntryEventPeer::PRJ_UID, + ProcessPeer::PRO_UID, + Criteria::JOIN + ); + if ($considerShowInCase) { + $criteria->add( + WebEntryPeer::WE_SHOW_IN_NEW_CASE, + "0", + Criteria::EQUAL + ); + } + $criteria->add(ProcessPeer::PRO_STATUS, 'ACTIVE', Criteria::EQUAL); + $rsCriteria = WebEntryEventPeer::doSelectRS($criteria); $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); while ($rsCriteria->next()) { $row = $rsCriteria->getRow(); $result[] = $this->getWebEntryEventDataFromRecord($row); } + return $result; - } catch (\Exception $e) { + } catch (Exception $e) { throw $e; } } @@ -1022,22 +1190,24 @@ class WebEntryEvent * Get data of a WebEntry-Event * * @param string $webEntryEventUid Unique id of WebEntry-Event - * @param bool $flagGetRecord Value that set the getting + * @param bool $flagGetRecord Value that set the getting * - * return array Return an array with data of a WebEntry-Event + * @return array Return an array with data of a WebEntry-Event + * @throws Exception */ public function getWebEntryEvent($webEntryEventUid, $flagGetRecord = false) { try { //Verify data - $this->throwExceptionIfNotExistsWebEntryEvent($webEntryEventUid, $this->arrayFieldNameForException["webEntryEventUid"]); + $this->throwExceptionIfNotExistsWebEntryEvent($webEntryEventUid, + $this->arrayFieldNameForException["webEntryEventUid"]); //Get data $criteria = $this->getWebEntryEventCriteria(); - $criteria->add(\WebEntryEventPeer::WEE_UID, $webEntryEventUid, \Criteria::EQUAL); + $criteria->add(WebEntryEventPeer::WEE_UID, $webEntryEventUid, Criteria::EQUAL); - $rsCriteria = \WebEntryEventPeer::doSelectRS($criteria); + $rsCriteria = WebEntryEventPeer::doSelectRS($criteria); $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); $rsCriteria->next(); @@ -1045,8 +1215,8 @@ class WebEntryEvent $row = $rsCriteria->getRow(); //Return - return (!$flagGetRecord)? $this->getWebEntryEventDataFromRecord($row) : $row; - } catch (\Exception $e) { + return (!$flagGetRecord) ? $this->getWebEntryEventDataFromRecord($row) : $row; + } catch (Exception $e) { throw $e; } } @@ -1054,11 +1224,12 @@ class WebEntryEvent /** * 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 + * @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 + * @return array Return an array with data of a WebEntry-Event by unique id of Event + * @throws Exception */ public function getWebEntryEventByEvent($projectUid, $eventUid, $flagGetRecord = false) { @@ -1069,16 +1240,17 @@ class WebEntryEvent $process->throwExceptionIfNotExistsProcess($projectUid, $this->arrayFieldNameForException["projectUid"]); if (!$this->existsEvent($projectUid, $eventUid)) { - throw new \Exception(\G::LoadTranslation("ID_WEB_ENTRY_EVENT_DOES_NOT_IS_REGISTERED", array($this->arrayFieldNameForException["eventUid"], $eventUid))); + throw new Exception(G::LoadTranslation("ID_WEB_ENTRY_EVENT_DOES_NOT_IS_REGISTERED", + array($this->arrayFieldNameForException["eventUid"], $eventUid))); } //Get data $criteria = $this->getWebEntryEventCriteria(); - $criteria->add(\WebEntryEventPeer::PRJ_UID, $projectUid, \Criteria::EQUAL); - $criteria->add(\WebEntryEventPeer::EVN_UID, $eventUid, \Criteria::EQUAL); + $criteria->add(WebEntryEventPeer::PRJ_UID, $projectUid, Criteria::EQUAL); + $criteria->add(WebEntryEventPeer::EVN_UID, $eventUid, Criteria::EQUAL); - $rsCriteria = \WebEntryEventPeer::doSelectRS($criteria); + $rsCriteria = WebEntryEventPeer::doSelectRS($criteria); $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); $rsCriteria->next(); @@ -1086,8 +1258,8 @@ class WebEntryEvent $row = $rsCriteria->getRow(); //Return - return (!$flagGetRecord)? $this->getWebEntryEventDataFromRecord($row) : $row; - } catch (\Exception $e) { + return (!$flagGetRecord) ? $this->getWebEntryEventDataFromRecord($row) : $row; + } catch (Exception $e) { throw $e; } } @@ -1097,17 +1269,19 @@ class WebEntryEvent * * @param string $userUid uid of a user * - * return integer $total + * @return integer $total + * @throws Exception */ public function getWebEntryRelatedToUser($userUid) { try { //Get data $criteria = $this->getWebEntryEventCriteria(); - $criteria->add(\WebEntryEventPeer::USR_UID, $userUid, \Criteria::EQUAL); - $total = \WebEntryEventPeer::doCount($criteria); + $criteria->add(WebEntryEventPeer::USR_UID, $userUid, Criteria::EQUAL); + $total = WebEntryEventPeer::doCount($criteria); + return $total; - } catch (\Exception $e) { + } catch (Exception $e) { throw $e; } } @@ -1122,21 +1296,22 @@ class WebEntryEvent */ public function generateLink($prj_uid, $wee_uid) { - $webEntryEvent = \WebEntryEventPeer::retrieveByPK($wee_uid); + $webEntryEvent = WebEntryEventPeer::retrieveByPK($wee_uid); if (empty($webEntryEvent)) { - throw new \Exception( - \G::LoadTranslation("ID_WEB_ENTRY_EVENT_DOES_NOT_EXIST", array("WEE_UID", $wee_uid)) + throw new Exception( + G::LoadTranslation("ID_WEB_ENTRY_EVENT_DOES_NOT_EXIST", array("WEE_UID", $wee_uid)) ); } - $webEntry = \WebEntryPeer::retrieveByPK($webEntryEvent->getWeeWeUid()); + $webEntry = WebEntryPeer::retrieveByPK($webEntryEvent->getWeeWeUid()); if (empty($webEntryEvent)) { - throw new \Exception( - \G::LoadTranslation( + throw new Exception( + G::LoadTranslation( "ID_WEB_ENTRY_EVENT_DOES_NOT_EXIST", array("WE_UID", $webEntryEvent->getWeeWeUid()) ) ); } + return $this->getGeneratedLink( $webEntry->getWeUid(), $prj_uid, @@ -1168,22 +1343,24 @@ class WebEntryEvent $weLinkSkin, $weData ) { - $http = (\G::is_https()) ? "https://" : "http://"; - $port = $_SERVER['SERVER_PORT'] == '80' ? '' : ':'.$_SERVER['SERVER_PORT']; + $http = (G::is_https()) ? "https://" : "http://"; + $port = $_SERVER['SERVER_PORT'] == '80' ? '' : ':' . $_SERVER['SERVER_PORT']; if ($weLinkGeneration === 'ADVANCED') { $domain = $weLinkDomain; $hasProtocol = strpos($domain, 'http://') === 0 || strpos($domain, 'https://') === 0; $hasPort = preg_match('/\:\d+$/', $domain); - $url = ($hasProtocol ? '' : $http). - $domain.($hasPort ? '' : $port). - "/sys".SYS_SYS."/". - $weLinkLanguage."/". - $weLinkSkin."/".$prj_uid; - return $url."/".$weData; + $url = ($hasProtocol ? '' : $http) . + $domain . ($hasPort ? '' : $port) . + "/sys" . SYS_SYS . "/" . + $weLinkLanguage . "/" . + $weLinkSkin . "/" . $prj_uid; + + return $url . "/" . $weData; } else { - $url = $http.$_SERVER["HTTP_HOST"]."/sys".SYS_SYS."/".SYS_LANG."/".SYS_SKIN."/".$prj_uid; - return $url."/".$weData; + $url = $http . $_SERVER["HTTP_HOST"] . "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/" . $prj_uid; + + return $url . "/" . $weData; } } }