2010-12-02 23:34:41 +00:00
|
|
|
<?php
|
|
|
|
|
/**
|
|
|
|
|
* Triggers.php
|
2011-01-31 14:14:55 +00:00
|
|
|
* @package workflow.engine.classes.model
|
2012-10-20 16:01:28 -04:00
|
|
|
*
|
2010-12-02 23:34:41 +00:00
|
|
|
* ProcessMaker Open Source Edition
|
2011-01-31 14:14:55 +00:00
|
|
|
* Copyright (C) 2004 - 2011 Colosa Inc.
|
2012-10-20 16:01:28 -04:00
|
|
|
*
|
2010-12-02 23:34:41 +00:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU Affero General Public License for more details.
|
2012-10-20 16:01:28 -04:00
|
|
|
*
|
2010-12-02 23:34:41 +00:00
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2012-10-20 16:01:28 -04:00
|
|
|
*
|
|
|
|
|
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
2010-12-02 23:34:41 +00:00
|
|
|
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
2012-10-20 16:01:28 -04:00
|
|
|
*
|
2010-12-02 23:34:41 +00:00
|
|
|
*/
|
|
|
|
|
|
2012-11-16 17:13:48 -04:00
|
|
|
//require_once 'classes/model/Content.php';
|
|
|
|
|
//require_once 'classes/model/om/BaseTriggers.php';
|
2010-12-02 23:34:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Skeleton subclass for representing a row from the 'TRIGGER' table.
|
|
|
|
|
*
|
2012-10-20 16:01:28 -04:00
|
|
|
*
|
2010-12-02 23:34:41 +00:00
|
|
|
*
|
|
|
|
|
* You should add additional methods to this class to meet the
|
|
|
|
|
* application requirements. This class will only be generated as
|
|
|
|
|
* long as it does not already exist in the output directory.
|
|
|
|
|
*
|
2011-01-31 14:14:55 +00:00
|
|
|
* @package workflow.engine.classes.model
|
2010-12-02 23:34:41 +00:00
|
|
|
*/
|
2012-10-20 16:01:28 -04:00
|
|
|
class Triggers extends BaseTriggers
|
|
|
|
|
{
|
2011-08-01 17:52:16 -04:00
|
|
|
|
2012-10-20 16:01:28 -04:00
|
|
|
/**
|
2016-12-22 17:16:01 -04:00
|
|
|
* This value goes in the content table
|
|
|
|
|
*
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
protected $tri_title_content = '';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the tri_title_content column value.
|
2012-10-20 16:01:28 -04:00
|
|
|
* @return string
|
|
|
|
|
*/
|
2016-12-01 09:32:35 -05:00
|
|
|
public function getTriTitleContent()
|
2010-12-02 23:34:41 +00:00
|
|
|
{
|
2012-10-20 16:01:28 -04:00
|
|
|
if ($this->getTriUid() == "") {
|
|
|
|
|
throw ( new Exception( "Error in getTriTitle, the getTriUid() can't be blank") );
|
|
|
|
|
}
|
|
|
|
|
$lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en';
|
2016-12-22 17:16:01 -04:00
|
|
|
$this->tri_title_content = Content::load ( 'TRI_TITLE', '', $this->getTriUid(), $lang );
|
|
|
|
|
return $this->tri_title_content;
|
2010-12-02 23:34:41 +00:00
|
|
|
}
|
2012-10-20 16:01:28 -04:00
|
|
|
|
|
|
|
|
/**
|
2016-12-22 17:16:01 -04:00
|
|
|
* Set the tri_title_content column value.
|
2012-10-20 16:01:28 -04:00
|
|
|
*
|
|
|
|
|
* @param string $v new value
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
2016-12-01 09:32:35 -05:00
|
|
|
public function setTriTitleContent($v)
|
2010-12-02 23:34:41 +00:00
|
|
|
{
|
2012-10-20 16:01:28 -04:00
|
|
|
if ($this->getTriUid() == "") {
|
|
|
|
|
throw ( new Exception( "Error in setTriTitle, the getTriUid() can't be blank") );
|
|
|
|
|
}
|
|
|
|
|
$v=isset($v)?((string)$v):'';
|
|
|
|
|
$lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en';
|
2017-04-06 10:04:29 -04:00
|
|
|
if (in_array(TriggersPeer::TRI_TITLE, $this->modifiedColumns) || $v==="") {
|
2016-12-22 17:16:01 -04:00
|
|
|
$this->tri_title_content = $v;
|
|
|
|
|
$res = Content::addContent( 'TRI_TITLE', '', $this->getTriUid(), $lang, $this->tri_title_content );
|
2012-10-20 16:01:28 -04:00
|
|
|
return $res;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
2010-12-02 23:34:41 +00:00
|
|
|
}
|
2012-10-20 16:01:28 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the tri_description column value.
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
|
2016-12-01 09:32:35 -05:00
|
|
|
public function getTriDescriptionContent()
|
2010-12-02 23:34:41 +00:00
|
|
|
{
|
2012-10-20 16:01:28 -04:00
|
|
|
if ($this->getTriUid() == "") {
|
|
|
|
|
throw ( new Exception( "Error in getTriDescription, the getTriUid() can't be blank") );
|
|
|
|
|
}
|
|
|
|
|
$lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en';
|
|
|
|
|
$this->tri_description = Content::load ( 'TRI_DESCRIPTION', '', $this->getTriUid(), $lang );
|
|
|
|
|
return $this->tri_description;
|
2010-12-02 23:34:41 +00:00
|
|
|
}
|
2012-10-20 16:01:28 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set the tri_description column value.
|
|
|
|
|
*
|
|
|
|
|
* @param string $v new value
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
2016-12-01 09:32:35 -05:00
|
|
|
public function setTriDescriptionContent($v)
|
2010-12-02 23:34:41 +00:00
|
|
|
{
|
2012-10-20 16:01:28 -04:00
|
|
|
if ($this->getTriUid() == "") {
|
|
|
|
|
throw ( new Exception( "Error in setTriDescription, the getTriUid() can't be blank") );
|
|
|
|
|
}
|
|
|
|
|
$v=isset($v)?((string)$v):'';
|
|
|
|
|
$lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en';
|
2017-04-06 10:04:29 -04:00
|
|
|
if (in_array(TriggersPeer::TRI_DESCRIPTION, $this->modifiedColumns) || $v==="") {
|
2012-10-20 16:01:28 -04:00
|
|
|
$this->tri_description = $v;
|
|
|
|
|
$res = Content::addContent( 'TRI_DESCRIPTION', '', $this->getTriUid(), $lang, $this->tri_description );
|
|
|
|
|
return $res;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
2010-12-02 23:34:41 +00:00
|
|
|
}
|
2012-10-20 16:01:28 -04:00
|
|
|
|
|
|
|
|
public function load($TriUid)
|
2010-12-02 23:34:41 +00:00
|
|
|
{
|
2012-10-20 16:01:28 -04:00
|
|
|
try {
|
|
|
|
|
$oRow = TriggersPeer::retrieveByPK( $TriUid );
|
|
|
|
|
if (!is_null($oRow)) {
|
|
|
|
|
$aFields = $oRow->toArray(BasePeer::TYPE_FIELDNAME);
|
|
|
|
|
$this->fromArray($aFields, BasePeer::TYPE_FIELDNAME);
|
|
|
|
|
return $aFields;
|
|
|
|
|
} else {
|
|
|
|
|
throw( new Exception( "The row '$TriUid' in table TRIGGERS doesn't exist!" ));
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception $oError) {
|
|
|
|
|
throw($oError);
|
|
|
|
|
}
|
2010-12-02 23:34:41 +00:00
|
|
|
}
|
2012-10-20 16:01:28 -04:00
|
|
|
|
|
|
|
|
public function create($aData)
|
2010-12-02 23:34:41 +00:00
|
|
|
{
|
2012-10-20 16:01:28 -04:00
|
|
|
$con = Propel::getConnection(TriggersPeer::DATABASE_NAME);
|
|
|
|
|
try {
|
|
|
|
|
$con->begin();
|
|
|
|
|
if (isset ( $aData['TRI_UID'] ) && $aData['TRI_UID']== '') {
|
|
|
|
|
unset ( $aData['TRI_UID'] );
|
|
|
|
|
}
|
|
|
|
|
if ( !isset ( $aData['TRI_UID'] ) ) {
|
|
|
|
|
$this->setTriUid(G::generateUniqueID());
|
|
|
|
|
} else {
|
|
|
|
|
$this->setTriUid($aData['TRI_UID'] );
|
|
|
|
|
}
|
2015-02-18 15:35:50 -04:00
|
|
|
$triggerUid = $this->getTriUid();
|
2012-10-20 16:01:28 -04:00
|
|
|
$this->setProUid($aData['PRO_UID']);
|
2016-12-01 09:32:35 -05:00
|
|
|
$triTitle = isset($aData['TRI_TITLE']) ? $aData['TRI_TITLE'] : '';
|
|
|
|
|
$this->setTriTitle($triTitle);
|
|
|
|
|
$triDescription = isset($aData['TRI_DESCRIPTION']) ? $aData['TRI_DESCRIPTION'] : '';
|
|
|
|
|
$this->setTriDescription($triDescription);
|
2012-10-20 16:01:28 -04:00
|
|
|
$this->setTriType("SCRIPT");
|
|
|
|
|
|
|
|
|
|
if (!isset ( $aData['TRI_WEBBOT'] )) {
|
|
|
|
|
$this->setTriWebbot("");
|
|
|
|
|
} else {
|
|
|
|
|
$this->setTriWebbot( $aData['TRI_WEBBOT'] );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($this->validate()) {
|
|
|
|
|
if (!isset ( $aData['TRI_PARAM'] )) {
|
|
|
|
|
$this->setTriParam("");
|
|
|
|
|
} else {
|
|
|
|
|
$this->setTriParam( $aData['TRI_PARAM'] );
|
|
|
|
|
}
|
2016-12-01 09:32:35 -05:00
|
|
|
$this->setTriTitleContent($triTitle);
|
|
|
|
|
$this->setTriDescriptionContent($triDescription);
|
2017-04-07 16:28:20 -04:00
|
|
|
$result = $this->save();
|
2012-10-20 16:01:28 -04:00
|
|
|
$con->commit();
|
2015-02-18 15:35:50 -04:00
|
|
|
//Add Audit Log
|
|
|
|
|
$description = "Trigger Name: ".$aData['TRI_TITLE'].", Trigger Uid: ".$triggerUid;
|
|
|
|
|
if (isset ( $aData['TRI_DESCRIPTION'] )) {
|
|
|
|
|
$description .= ", Description: ".$aData['TRI_DESCRIPTION'];
|
|
|
|
|
}
|
|
|
|
|
G::auditLog("CreateTrigger", $description);
|
2015-03-02 17:48:53 -04:00
|
|
|
|
2012-10-20 16:01:28 -04:00
|
|
|
return $result;
|
|
|
|
|
} else {
|
|
|
|
|
$con->rollback();
|
|
|
|
|
throw(new Exception("Failed Validation in class ".get_class($this)."."));
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception $e) {
|
|
|
|
|
$con->rollback();
|
|
|
|
|
throw($e);
|
|
|
|
|
}
|
2010-12-02 23:34:41 +00:00
|
|
|
}
|
|
|
|
|
|
2012-10-20 16:01:28 -04:00
|
|
|
public function update($fields)
|
|
|
|
|
{
|
|
|
|
|
$con = Propel::getConnection(TriggersPeer::DATABASE_NAME);
|
|
|
|
|
try {
|
|
|
|
|
$con->begin();
|
|
|
|
|
$this->load($fields['TRI_UID']);
|
|
|
|
|
$this->fromArray($fields,BasePeer::TYPE_FIELDNAME);
|
|
|
|
|
if ($this->validate()) {
|
|
|
|
|
$contentResult=0;
|
|
|
|
|
if (array_key_exists("TRI_TITLE", $fields)) {
|
2016-12-01 09:32:35 -05:00
|
|
|
$contentResult += $this->setTriTitleContent($fields["TRI_TITLE"]);
|
2012-10-20 16:01:28 -04:00
|
|
|
}
|
|
|
|
|
if (array_key_exists("TRI_DESCRIPTION", $fields)) {
|
2016-12-01 09:32:35 -05:00
|
|
|
$contentResult += $this->setTriDescriptionContent($fields["TRI_DESCRIPTION"]);
|
2012-10-20 16:01:28 -04:00
|
|
|
}
|
2016-12-01 09:32:35 -05:00
|
|
|
$this->setNew(false);
|
|
|
|
|
$result = $this->save();
|
2012-10-20 16:01:28 -04:00
|
|
|
$result=($result==0)?($contentResult>0?1:0):$result;
|
|
|
|
|
$con->commit();
|
|
|
|
|
return $result;
|
|
|
|
|
} else {
|
|
|
|
|
$con->rollback();
|
|
|
|
|
$validationE=new Exception("Failed Validation in class ".get_class($this).".");
|
|
|
|
|
$validationE->aValidationFailures = $this->getValidationFailures();
|
|
|
|
|
throw($validationE);
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception $e) {
|
|
|
|
|
$con->rollback();
|
|
|
|
|
throw($e);
|
|
|
|
|
}
|
2010-12-02 23:34:41 +00:00
|
|
|
}
|
2012-10-20 16:01:28 -04:00
|
|
|
|
|
|
|
|
public function remove($TriUid)
|
|
|
|
|
{
|
|
|
|
|
$con = Propel::getConnection(TriggersPeer::DATABASE_NAME);
|
|
|
|
|
try {
|
|
|
|
|
$result = false;
|
|
|
|
|
$con->begin();
|
|
|
|
|
$oTri = TriggersPeer::retrieveByPK( $TriUid );
|
|
|
|
|
if (!is_null($oTri)) {
|
2015-03-02 17:48:53 -04:00
|
|
|
Content::removeContent("TRI_TITLE", "", $TriUid);
|
|
|
|
|
Content::removeContent("TRI_DESCRIPTION", "", $TriUid);
|
|
|
|
|
|
2012-10-20 16:01:28 -04:00
|
|
|
$result = $oTri->delete();
|
|
|
|
|
$con->commit();
|
2015-03-02 17:48:53 -04:00
|
|
|
|
2015-02-18 15:35:50 -04:00
|
|
|
//Add Audit Log
|
2015-03-02 17:48:53 -04:00
|
|
|
G::auditLog("DeleteTrigger", "Trigger Name: " . $oTri->getTriTitle() . ", Trigger Uid: " . $TriUid . ", Description: " . $oTri->getTriDescription());
|
2012-10-20 16:01:28 -04:00
|
|
|
}
|
|
|
|
|
return $result;
|
|
|
|
|
} catch (Exception $e) {
|
|
|
|
|
$con->rollback();
|
|
|
|
|
throw($e);
|
|
|
|
|
}
|
2010-12-02 23:34:41 +00:00
|
|
|
}
|
|
|
|
|
|
2012-10-20 16:01:28 -04:00
|
|
|
/**
|
|
|
|
|
* verify if Trigger row specified in [sUid] exists.
|
|
|
|
|
*
|
|
|
|
|
* @param string $sUid the uid of the Prolication
|
|
|
|
|
*/
|
|
|
|
|
public function TriggerExists ($sUid)
|
|
|
|
|
{
|
|
|
|
|
$con = Propel::getConnection(TriggersPeer::DATABASE_NAME);
|
|
|
|
|
try {
|
|
|
|
|
$oObj = TriggersPeer::retrieveByPk( $sUid );
|
|
|
|
|
if (is_object($oObj) && get_class ($oObj) == 'Triggers' ) {
|
|
|
|
|
return true;
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception $oError) {
|
|
|
|
|
throw($oError);
|
|
|
|
|
}
|
2010-12-02 23:34:41 +00:00
|
|
|
}
|
2012-10-20 16:01:28 -04:00
|
|
|
|
|
|
|
|
public function verifyDependecies($TRI_UID)
|
|
|
|
|
{
|
|
|
|
|
require_once "classes/model/Event.php";
|
|
|
|
|
require_once "classes/model/StepTrigger.php";
|
|
|
|
|
|
|
|
|
|
$oResult = new stdClass();
|
|
|
|
|
$oResult->dependencies = Array();
|
|
|
|
|
|
|
|
|
|
$oCriteria = new Criteria();
|
|
|
|
|
$oCriteria->addSelectColumn(EventPeer::EVN_UID);
|
|
|
|
|
$oCriteria->addSelectColumn(EventPeer::TRI_UID);
|
|
|
|
|
$oCriteria->add(EventPeer::EVN_ACTION, '', Criteria::NOT_EQUAL);
|
|
|
|
|
$oCriteria->add(EventPeer::TRI_UID, $TRI_UID);
|
|
|
|
|
|
|
|
|
|
$oDataset = EventPeer::doSelectRS($oCriteria);
|
|
|
|
|
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
|
|
|
|
|
|
|
|
|
$aRows = Array();
|
|
|
|
|
while ($oDataset->next()) {
|
|
|
|
|
array_push($aRows, $oDataset->getRow());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$oResult->dependencies['Events'] = Array();
|
|
|
|
|
if (count($aRows) == 0) {
|
|
|
|
|
$oResult->code = 0;
|
|
|
|
|
} else {
|
|
|
|
|
$oResult->code = 1;
|
|
|
|
|
foreach ($aRows as $row) {
|
|
|
|
|
$oTrigger = TriggersPeer::retrieveByPK($row['TRI_UID']);
|
|
|
|
|
array_push($oResult->dependencies['Events'], Array('UID'=>($oTrigger->getTriUid()), 'DESCRIPTION'=>($oTrigger->getTriTitle())));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//for tasks dependencies
|
|
|
|
|
$oCriteria = new Criteria();
|
|
|
|
|
$oCriteria->addSelectColumn(StepTriggerPeer::TAS_UID);
|
|
|
|
|
$oCriteria->addSelectColumn(StepTriggerPeer::TRI_UID);
|
|
|
|
|
$oCriteria->add(StepTriggerPeer::TRI_UID, $TRI_UID);
|
|
|
|
|
|
|
|
|
|
$oDataset = StepTriggerPeer::doSelectRS($oCriteria);
|
|
|
|
|
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
|
|
|
|
|
|
|
|
|
$aRows = Array();
|
|
|
|
|
while ( $oDataset->next() ) {
|
|
|
|
|
array_push($aRows, $oDataset->getRow());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$oResult->dependencies['Tasks'] = Array();
|
|
|
|
|
if ($oResult->code == 0 && count($aRows) == 0) {
|
|
|
|
|
$oResult->code = 0;
|
|
|
|
|
} elseif (count($aRows) > 0) {
|
|
|
|
|
$oResult->code = 1;
|
|
|
|
|
foreach ($aRows as $row) {
|
|
|
|
|
$oTask = TaskPeer::retrieveByPK($row['TAS_UID']);
|
|
|
|
|
array_push($oResult->dependencies['Tasks'], Array('UID'=>($oTask->getTasUid()), 'DESCRIPTION'=>($oTask->getTasTitle())));
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-10-22 13:55:35 -04:00
|
|
|
|
|
|
|
|
//Tasks, assignment rules dependencies
|
|
|
|
|
$criteria = new Criteria();
|
|
|
|
|
|
|
|
|
|
$criteria->addSelectColumn(TaskPeer::TAS_UID);
|
|
|
|
|
$criteria->add(TaskPeer::TAS_SELFSERVICE_TIMEOUT, 1);
|
|
|
|
|
$criteria->add(TaskPeer::TAS_SELFSERVICE_TRIGGER_UID, $TRI_UID);
|
|
|
|
|
|
|
|
|
|
$rsCriteria = TaskPeer::doSelectRS($criteria);
|
|
|
|
|
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
|
|
|
|
|
|
|
|
|
$arrayRow = array();
|
|
|
|
|
|
|
|
|
|
while ($rsCriteria->next()) {
|
|
|
|
|
array_push($arrayRow, $rsCriteria->getRow());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$oResult->dependencies["Assignment rules"] = array();
|
|
|
|
|
|
|
|
|
|
if ($oResult->code == 0 && count($arrayRow) == 0) {
|
|
|
|
|
$oResult->code = 0;
|
|
|
|
|
} else {
|
|
|
|
|
if (count($arrayRow) > 0) {
|
|
|
|
|
foreach ($arrayRow as $row) {
|
|
|
|
|
$task = TaskPeer::retrieveByPK($row["TAS_UID"]);
|
|
|
|
|
array_push($oResult->dependencies["Assignment rules"], array("UID" => $task->getTasUid(), "DESCRIPTION" => $task->getTasTitle()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$oResult->code = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-12-01 09:32:35 -05:00
|
|
|
|
2016-03-30 13:50:41 -04:00
|
|
|
/**
|
|
|
|
|
* Process elements:
|
2016-12-01 09:32:35 -05:00
|
|
|
*
|
2016-03-30 13:50:41 -04:00
|
|
|
* PRO_TRI_DELETED
|
|
|
|
|
* PRO_TRI_CANCELED
|
|
|
|
|
* PRO_TRI_PAUSED
|
|
|
|
|
* PRO_TRI_REASSIGNED
|
|
|
|
|
* PRO_TRI_OPEN
|
|
|
|
|
*/
|
|
|
|
|
$criteria = new Criteria();
|
|
|
|
|
|
|
|
|
|
$crit0 = $criteria->getNewCriterion(ProcessPeer::PRO_TRI_DELETED, $TRI_UID);
|
|
|
|
|
$crit1 = $criteria->getNewCriterion(ProcessPeer::PRO_TRI_CANCELED, $TRI_UID);
|
|
|
|
|
$crit2 = $criteria->getNewCriterion(ProcessPeer::PRO_TRI_PAUSED, $TRI_UID);
|
|
|
|
|
$crit3 = $criteria->getNewCriterion(ProcessPeer::PRO_TRI_REASSIGNED, $TRI_UID);
|
|
|
|
|
$crit4 = $criteria->getNewCriterion(ProcessPeer::PRO_TRI_OPEN, $TRI_UID);
|
|
|
|
|
|
|
|
|
|
$crit0->addOr($crit1);
|
|
|
|
|
$crit0->addOr($crit2);
|
|
|
|
|
$crit0->addOr($crit3);
|
|
|
|
|
$crit0->addOr($crit4);
|
|
|
|
|
|
|
|
|
|
$criteria->addSelectColumn(ProcessPeer::PRO_UID);
|
|
|
|
|
$criteria->addSelectColumn(ProcessPeer::PRO_TRI_DELETED);
|
|
|
|
|
$criteria->addSelectColumn(ProcessPeer::PRO_TRI_CANCELED);
|
|
|
|
|
$criteria->addSelectColumn(ProcessPeer::PRO_TRI_PAUSED);
|
|
|
|
|
$criteria->addSelectColumn(ProcessPeer::PRO_TRI_REASSIGNED);
|
|
|
|
|
$criteria->addSelectColumn(ProcessPeer::PRO_TRI_OPEN);
|
|
|
|
|
$criteria->add($crit0);
|
|
|
|
|
|
|
|
|
|
$rsCriteria = ProcessPeer::doSelectRS($criteria);
|
|
|
|
|
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
|
|
|
|
|
|
|
|
|
$arrayRow = array();
|
|
|
|
|
|
|
|
|
|
while ($rsCriteria->next()) {
|
|
|
|
|
array_push($arrayRow, $rsCriteria->getRow());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$oResult->dependencies["Process"] = array();
|
|
|
|
|
|
|
|
|
|
if ($oResult->code == 0 && count($arrayRow) == 0) {
|
|
|
|
|
$oResult->code = 0;
|
|
|
|
|
} else {
|
|
|
|
|
if (count($arrayRow) > 0) {
|
|
|
|
|
foreach ($arrayRow as $row) {
|
|
|
|
|
$process = ProcessPeer::retrieveByPK($row["PRO_UID"]);
|
|
|
|
|
array_push($oResult->dependencies["Process"], array("UID" => $process->getProUid(), "DESCRIPTION" => $process->getProTitle()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$oResult->code = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-10-22 13:55:35 -04:00
|
|
|
|
2012-10-20 16:01:28 -04:00
|
|
|
return $oResult;
|
2010-12-02 23:34:41 +00:00
|
|
|
}
|
2012-10-20 16:01:28 -04:00
|
|
|
}
|
|
|
|
|
|