Пример #1
0
 function Exists($sUid)
 {
     try {
         $oObj = ProcessUserPeer::retrieveByPk($sUid);
         return is_object($oObj) && get_class($oObj) == 'ProcessUser';
     } catch (Exception $oError) {
         throw $oError;
     }
 }
Пример #2
0
 /**
  * Implementation for 'GET' method for Rest API
  *
  * @param  mixed $puUid Primary key
  *
  * @return array $result Returns array within multiple records or a single record depending if
  *                       a single selection was requested passing id(s) as param
  */
 protected function get($puUid = null)
 {
     $result = array();
     try {
         $noArguments = true;
         $argumentList = func_get_args();
         foreach ($argumentList as $arg) {
             if (!is_null($arg)) {
                 $noArguments = false;
             }
         }
         if ($noArguments) {
             $criteria = new Criteria('workflow');
             $criteria->addSelectColumn(ProcessUserPeer::PU_UID);
             $criteria->addSelectColumn(ProcessUserPeer::PRO_UID);
             $criteria->addSelectColumn(ProcessUserPeer::USR_UID);
             $criteria->addSelectColumn(ProcessUserPeer::PU_TYPE);
             $dataset = AppEventPeer::doSelectRS($criteria);
             $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
             while ($dataset->next()) {
                 $result[] = $dataset->getRow();
             }
         } else {
             $record = ProcessUserPeer::retrieveByPK($puUid);
             if ($record) {
                 $result = $record->toArray(BasePeer::TYPE_FIELDNAME);
             } else {
                 $paramValues = "";
                 foreach ($argumentList as $arg) {
                     $paramValues .= strlen($paramValues) ? ', ' : '';
                     if (!is_null($arg)) {
                         $paramValues .= "{$arg}";
                     } else {
                         $paramValues .= "NULL";
                     }
                 }
                 throw new RestException(417, "table ProcessUser ({$paramValues})");
             }
         }
     } catch (RestException $e) {
         throw new RestException($e->getCode(), $e->getMessage());
     } catch (Exception $e) {
         throw new RestException(412, $e->getMessage());
     }
     return $result;
 }
Пример #3
0
 public function getProUidSupervisor($userUid)
 {
     //finding cases PRO_UID where $userUid is supervising
     require_once 'classes/model/ProcessUser.php';
     require_once 'classes/model/GroupUser.php';
     $oCriteria = new Criteria('workflow');
     if (!empty($userUid)) {
         $oCriteria->add(ProcessUserPeer::USR_UID, $userUid);
     }
     $oCriteria->add(ProcessUserPeer::PU_TYPE, 'SUPERVISOR');
     $oDataset = ProcessUserPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $oDataset->next();
     $aProcesses = array();
     while ($aRow = $oDataset->getRow()) {
         $aProcesses[] = $aRow['PRO_UID'];
         $oDataset->next();
     }
     $oCriteria = new Criteria('workflow');
     $oCriteria->addSelectColumn(ProcessUserPeer::PRO_UID);
     $oCriteria->add(ProcessUserPeer::PU_TYPE, 'GROUP_SUPERVISOR');
     $oCriteria->addJoin(ProcessUserPeer::USR_UID, GroupUserPeer::USR_UID, Criteria::LEFT_JOIN);
     if (!empty($userUid)) {
         $oCriteria->add(GroupUserPeer::USR_UID, $userUid);
     }
     $oDataset = ProcessUserPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $oDataset->next();
     while ($aRow = $oDataset->getRow()) {
         $aProcesses[] = $aRow['PRO_UID'];
         $oDataset->next();
     }
     return $aProcesses;
 }
Пример #4
0
 */
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'cases';
$G_ID_MENU_SELECTED = 'CASES';
$G_ID_SUB_MENU_SELECTED = 'CASES_ADVANCEDSEARCH';
$G_PUBLISH = new Publisher();
global $RBAC;
$permisse = $RBAC->userCanAccess('PM_ALLCASES');
$userlogged = $_SESSION['USER_LOGGED'];
require_once "classes/model/ProcessUser.php";
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(ProcessUserPeer::PU_UID);
$oCriteria->addSelectColumn(ProcessUserPeer::PRO_UID);
$oCriteria->add(ProcessUserPeer::USR_UID, $userlogged);
$oCriteria->add(ProcessUserPeer::PU_TYPE, "SUPERVISOR");
$oDataset = ProcessUserPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$aSupervisor = array();
while ($aRow = $oDataset->getRow()) {
    $aSupervisor[] = $aRow['PRO_UID'];
    $oDataset->next();
}
G::LoadClass('case');
$oCases = new Cases();
if (isset($_POST['form'])) {
    $fields['CASE_NUMBER'] = $_POST['form']['CASE_NUMBER'];
    $fields['PROCESS'] = $_POST['form']['PROCESS'];
    $fields['TASKS'] = $_POST['form']['TASKS'];
    $fields['CURRENT_USER'] = $_POST['form']['CURRENT_USER'];
    $fields['SENT_BY'] = $_POST['form']['SENT_BY'];
Пример #5
0
    public function getUsersToReassign($TAS_UID, $USR_UID, $PRO_UID=null)

    {

        G::LoadClass('groups');

        G::LoadClass('tasks');



        $oTasks = new Tasks();

        $aAux = $oTasks->getGroupsOfTask($TAS_UID, 1);

        $row = array();

        $groups = new Groups();

        foreach ($aAux as $aGroup) {

            $aUsers = $groups->getUsersOfGroup($aGroup['GRP_UID']);

            foreach ($aUsers as $aUser) {

                if ($aUser['USR_UID'] != $USR_UID) {

                    $row[] = $aUser['USR_UID'];

                }

            }

        }



        $aAux = $oTasks->getUsersOfTask($TAS_UID, 1);

        foreach ($aAux as $aUser) {

            if ($aUser['USR_UID'] != $USR_UID) {

                $row[] = $aUser['USR_UID'];

            }

        }



        // Group Ad Hoc

        $oTasks = new Tasks();

        $aAux = $oTasks->getGroupsOfTask($TAS_UID, 2);

        $groups = new Groups();

        foreach ($aAux as $aGroup) {

            $aUsers = $groups->getUsersOfGroup($aGroup['GRP_UID']);

            foreach ($aUsers as $aUser) {

                if ($aUser['USR_UID'] != $USR_UID) {

                    $row[] = $aUser['USR_UID'];

                }

            }

        }



        // User Ad Hoc

        $aAux = $oTasks->getUsersOfTask($TAS_UID, 2);

        foreach ($aAux as $aUser) {

            if ($aUser['USR_UID'] != $USR_UID) {

                $row[] = $aUser['USR_UID'];

            }

        }



        global $RBAC;

        //Adding the actual user if this has the PM_SUPERVISOR permission assigned.

        if ($RBAC->userCanAccess('PM_SUPERVISOR') == 1) {

            if(!in_array($RBAC->aUserInfo['USER_INFO']['USR_UID'], $row)) {

                $row[] = $RBAC->aUserInfo['USER_INFO']['USR_UID'];

            }

        }



        $c = new Criteria('workflow');

        $c->addSelectColumn(UsersPeer::USR_UID);

        $c->addSelectColumn(UsersPeer::USR_USERNAME);

        $c->addSelectColumn(UsersPeer::USR_FIRSTNAME);

        $c->addSelectColumn(UsersPeer::USR_LASTNAME);

        $c->add(UsersPeer::USR_UID, $row, Criteria::IN);



        $rs = UsersPeer::doSelectRs($c);

        $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);



        $rows = Array();

        while ($rs->next()) {

            $rows[] = $rs->getRow();

        }



        if ($PRO_UID != null) {

            //Add supervisor

            // Users

            $oCriteria = new Criteria('workflow');

            $oCriteria->addSelectColumn(ProcessUserPeer::PU_UID);

            $oCriteria->addSelectColumn(ProcessUserPeer::USR_UID);

            $oCriteria->addSelectColumn(ProcessUserPeer::PRO_UID);

            $oCriteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);

            $oCriteria->addSelectColumn(UsersPeer::USR_LASTNAME);

            $oCriteria->addSelectColumn(UsersPeer::USR_USERNAME);

            $oCriteria->addSelectColumn(UsersPeer::USR_EMAIL);

            $oCriteria->addJoin(ProcessUserPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN);

            $oCriteria->add(ProcessUserPeer::PU_TYPE, 'SUPERVISOR');

            $oCriteria->add(ProcessUserPeer::PRO_UID, $PRO_UID);

            $oCriteria->add(ProcessUserPeer::USR_UID, $USR_UID);

            $oCriteria->addAscendingOrderByColumn(UsersPeer::USR_FIRSTNAME);

            $oDataset = ProcessUserPeer::doSelectRS($oCriteria);

            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);

            $flagSupervisors = false;



            if ($oDataset->next()) {

                if (!in_array($USR_UID,$row)) {

                        $rows[] = $oDataset->getRow();

                }

                $flagSupervisors = true;

            }



            if (!$flagSupervisors) {

                // Groups

                $oCriteria = new Criteria('workflow');

                $oCriteria->addSelectColumn(ProcessUserPeer::PU_UID);

                $oCriteria->addSelectColumn(ProcessUserPeer::USR_UID);

                $oCriteria->addSelectColumn(ProcessUserPeer::PRO_UID);



                $oCriteria->addSelectColumn(UsersPeer::USR_UID);

                $oCriteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);

                $oCriteria->addSelectColumn(UsersPeer::USR_LASTNAME);

                $oCriteria->addSelectColumn(UsersPeer::USR_USERNAME);

                $oCriteria->addSelectColumn(UsersPeer::USR_EMAIL);



                $oCriteria->addJoin(ProcessUserPeer::USR_UID, GroupUserPeer::GRP_UID, Criteria::LEFT_JOIN);

                $oCriteria->addJoin(GroupUserPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN);



                $oCriteria->add(ProcessUserPeer::PU_TYPE, 'GROUP_SUPERVISOR');

                $oCriteria->add(ProcessUserPeer::PRO_UID, $PRO_UID);

                $oCriteria->add(GroupUserPeer::USR_UID, $USR_UID);



                $oDataset = ProcessUserPeer::doSelectRS($oCriteria);

                $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);



                if ($oDataset->next()) {

                    if (!in_array($USR_UID,$row)) {

                        $rows[] = $oDataset->getRow();

                    }

                }

            }

        }



        return $rows;

    }
Пример #6
0
 /**
  * Get Object Permission Rows from a Process
  *
  * @param string $sProUid
  * @return $aDynaform array
  */
 public function getGroupwfSupervisor($sProUid, &$oData)
 {
     try {
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(ProcessUserPeer::PRO_UID, $sProUid);
         $oCriteria->add(ProcessUserPeer::PU_TYPE, 'GROUP_SUPERVISOR');
         $oDataset = ProcessUserPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oGroupwf = new Groupwf();
             $oData->groupwfs[] = $oGroupwf->Load($aRow['USR_UID']);
             $oDataset->next();
         }
         return true;
     } catch (Exception $oError) {
         throw $oError;
     }
 }
Пример #7
0
 /**
  * listExtNoProcessesUser for Extjs
  *
  * @param string $sProcessUID
  * @return array(aAvailableUser) $aAvailableUser
  */
 public function listExtNoProcessesUser($sProcessUID)
 {
     G::LoadSystem('rbac');
     $memcache =& PMmemcached::getSingleton(SYS_SYS);
     $oCriteria = new Criteria('workflow');
     $oCriteria->addSelectColumn(ProcessUserPeer::USR_UID);
     $oCriteria->add(ProcessUserPeer::PRO_UID, $sProcessUID);
     $oCriteria->add(ProcessUserPeer::PU_TYPE, 'SUPERVISOR');
     $oDataset = ProcessUserPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $oDataset->next();
     $aUIDS = array();
     while ($aRow = $oDataset->getRow()) {
         $aUIDS[] = $aRow['USR_UID'];
         $oDataset->next();
     }
     $sDelimiter = DBAdapter::getStringDelimiter();
     $oCriteria = new Criteria('workflow');
     $oCriteria->addSelectColumn(UsersPeer::USR_UID);
     $oCriteria->add(UsersPeer::USR_UID, $aUIDS, Criteria::NOT_IN);
     $oDataset = UsersPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $oDataset->next();
     $aUIDS = array();
     $oRBAC = RBAC::getSingleton();
     while ($aRow = $oDataset->getRow()) {
         $memKey = 'rbacSession' . session_id();
         if (($oRBAC->aUserInfo = $memcache->get($memKey)) === false) {
             $oRBAC->loadUserRolePermission($oRBAC->sSystem, $aRow['USR_UID']);
             $memcache->set($memKey, $oRBAC->aUserInfo, PMmemcached::EIGHT_HOURS);
         }
         $aPermissions = $oRBAC->aUserInfo[$oRBAC->sSystem]['PERMISSIONS'];
         $bInclude = false;
         foreach ($aPermissions as $aPermission) {
             if ($aPermission['PER_CODE'] == 'PM_SUPERVISOR') {
                 $bInclude = true;
             }
         }
         if ($bInclude) {
             $aUIDS[] = $aRow['USR_UID'];
         }
         $oDataset->next();
     }
     $oCriteria = new Criteria('workflow');
     $oCriteria->addSelectColumn(UsersPeer::USR_UID);
     $oCriteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
     $oCriteria->addSelectColumn(UsersPeer::USR_LASTNAME);
     $oCriteria->add(UsersPeer::USR_UID, $aUIDS, Criteria::IN);
     $oDataset = UsersPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $oDataset->next();
     $aAvailableUser = '';
     while ($aRow = $oDataset->getRow()) {
         $aAvailableUser[] = array('USR_UID' => $aRow['USR_UID'], 'USR_FIRSTNAME' => $aRow['USR_FIRSTNAME'], 'USR_LASTNAME' => $aRow['USR_LASTNAME']);
         $oDataset->next();
     }
     return $aAvailableUser;
 }
Пример #8
0
 /**
  * Get the condition for Cases List
  *
  * @name getConditionCasesList
  * @param string $sTypeList
  * @param string $sUIDUserLogged
  * @param string $ClearSession
  * @param string $aAdditionalFilter
  * @return array
  */
 public function getConditionCasesList($sTypeList = 'all', $sUIDUserLogged = '', $ClearSession = true, $aAdditionalFilter = null)
 {
     $c = new Criteria('workflow');
     $c->clearSelectColumns();
     $c->addSelectColumn(ApplicationPeer::APP_UID);
     $c->addSelectColumn(ApplicationPeer::APP_NUMBER);
     $c->addSelectColumn(ApplicationPeer::APP_UPDATE_DATE);
     $c->addSelectColumn(ApplicationPeer::PRO_UID);
     $c->addSelectColumn(ApplicationPeer::APP_INIT_USER);
     $c->addSelectColumn(AppDelegationPeer::DEL_PRIORITY);
     //$c->addSelectColumn(AppDelegationPeer::DEL_TASK_DUE_DATE);
     $c->addAsColumn('DEL_TASK_DUE_DATE', " IF (" . AppDelegationPeer::DEL_TASK_DUE_DATE . " <= NOW(), CONCAT('<span style=\\'color:red\\';>', " . AppDelegationPeer::DEL_TASK_DUE_DATE . ", '</span>'), " . AppDelegationPeer::DEL_TASK_DUE_DATE . ") ");
     global $RBAC;
     //seems the PM_SUPERVISOR can delete a completed case
     if ($sTypeList == "completed" && $RBAC->userCanAccess('PM_SUPERVISOR') == 1) {
         $c->addAsColumn("DEL_LINK", "CONCAT('" . G::LoadTranslation('ID_DELETE') . "')");
     }
     $c->addSelectColumn(AppDelegationPeer::DEL_INDEX);
     $c->addSelectColumn(AppDelegationPeer::TAS_UID);
     $c->addSelectColumn(AppDelegationPeer::DEL_INIT_DATE);
     $c->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE);
     $c->addSelectColumn(UsersPeer::USR_UID);
     $c->addAsColumn('APP_CURRENT_USER', "CONCAT(USERS.USR_LASTNAME, ' ', USERS.USR_FIRSTNAME)");
     $c->addSelectColumn(ApplicationPeer::APP_STATUS);
     $c->addAsColumn('APP_TITLE', 'APP_TITLE.CON_VALUE');
     $c->addAsColumn('APP_PRO_TITLE', 'PRO_TITLE.CON_VALUE');
     $c->addAsColumn('APP_TAS_TITLE', 'TAS_TITLE.CON_VALUE');
     //$c->addAsColumn('APP_DEL_PREVIOUS_USER', 'APP_LAST_USER.USR_USERNAME');
     $c->addAsColumn('APP_DEL_PREVIOUS_USER', "CONCAT(APP_LAST_USER.USR_LASTNAME,\n            ' ',\n            APP_LAST_USER.USR_FIRSTNAME)");
     $c->addAlias("APP_TITLE", 'CONTENT');
     $c->addAlias("PRO_TITLE", 'CONTENT');
     $c->addAlias("TAS_TITLE", 'CONTENT');
     $c->addAlias("APP_PREV_DEL", 'APP_DELEGATION');
     $c->addAlias("APP_LAST_USER", 'USERS');
     $c->addJoin(ApplicationPeer::APP_UID, AppDelegationPeer::APP_UID, Criteria::LEFT_JOIN);
     $c->addJoin(AppDelegationPeer::TAS_UID, TaskPeer::TAS_UID, Criteria::LEFT_JOIN);
     $appThreadConds[] = array(ApplicationPeer::APP_UID, AppThreadPeer::APP_UID);
     $appThreadConds[] = array(AppDelegationPeer::DEL_INDEX, AppThreadPeer::DEL_INDEX);
     $c->addJoinMC($appThreadConds, Criteria::LEFT_JOIN);
     $c->addJoin(AppDelegationPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN);
     $del = DBAdapter::getStringDelimiter();
     $appTitleConds = array();
     $appTitleConds[] = array(ApplicationPeer::APP_UID, 'APP_TITLE.CON_ID');
     $appTitleConds[] = array('APP_TITLE.CON_CATEGORY', $del . 'APP_TITLE' . $del);
     $appTitleConds[] = array('APP_TITLE.CON_LANG', $del . SYS_LANG . $del);
     $c->addJoinMC($appTitleConds, Criteria::LEFT_JOIN);
     $proTitleConds = array();
     $proTitleConds[] = array(ApplicationPeer::PRO_UID, 'PRO_TITLE.CON_ID');
     $proTitleConds[] = array('PRO_TITLE.CON_CATEGORY', $del . 'PRO_TITLE' . $del);
     $proTitleConds[] = array('PRO_TITLE.CON_LANG', $del . SYS_LANG . $del);
     $c->addJoinMC($proTitleConds, Criteria::LEFT_JOIN);
     $tasTitleConds = array();
     $tasTitleConds[] = array(AppDelegationPeer::TAS_UID, 'TAS_TITLE.CON_ID');
     $tasTitleConds[] = array('TAS_TITLE.CON_CATEGORY', $del . 'TAS_TITLE' . $del);
     $tasTitleConds[] = array('TAS_TITLE.CON_LANG', $del . SYS_LANG . $del);
     $c->addJoinMC($tasTitleConds, Criteria::LEFT_JOIN);
     $prevConds = array();
     $prevConds[] = array(ApplicationPeer::APP_UID, 'APP_PREV_DEL.APP_UID');
     $prevConds[] = array('APP_PREV_DEL.DEL_INDEX', AppDelegationPeer::DEL_PREVIOUS);
     $c->addJoinMC($prevConds, Criteria::LEFT_JOIN);
     $usrConds = array();
     $usrConds[] = array('APP_PREV_DEL.USR_UID', 'APP_LAST_USER.USR_UID');
     $c->addJoinMC($usrConds, Criteria::LEFT_JOIN);
     $c->add(TaskPeer::TAS_TYPE, 'SUBPROCESS', Criteria::NOT_EQUAL);
     //gral, to_revise, to_reassign dont have userid in the query
     if ($sTypeList != 'gral' && $sTypeList != 'to_revise' && $sTypeList != 'to_reassign' && $sTypeList != 'my_started' && $sTypeList != 'sent') {
         $c->add(UsersPeer::USR_UID, $sUIDUserLogged);
     }
     /**
      * Additional filters
      * By Erik <*****@*****.**>
      */
     if (isset($aAdditionalFilter) && is_array($aAdditionalFilter)) {
         foreach ($aAdditionalFilter as $sFilter => $sValue) {
             switch ($sFilter) {
                 case 'PRO_UID':
                     if ($sValue != "0") {
                         $c->add(ApplicationPeer::PRO_UID, $sValue, Criteria::EQUAL);
                     }
                     break;
                 case 'READ':
                     $c->add(AppDelegationPeer::DEL_INIT_DATE, null, Criteria::ISNOTNULL);
                     break;
                 case 'UNREAD':
                     $c->add(AppDelegationPeer::DEL_INIT_DATE, null, Criteria::ISNULL);
                     break;
             }
         }
     }
     $filesList = array('to_do' => 'cases/cases_ListTodo', 'draft' => 'cases/cases_ListDraft', 'paused' => 'cases/cases_ListOnHold', 'cancelled' => 'cases/cases_ListCancelled', 'completed' => 'cases/cases_ListCompleted', 'sent' => 'cases/cases_ListSent', 'selfservice' => 'cases/cases_ListSelfService', 'all' => 'cases/cases_ListAll', 'to_revise' => 'cases/cases_ListToRevise', 'to_reassign' => 'cases/cases_ListAll_Reassign', 'my_started' => 'cases/cases_ListStarted', 'Alldelete' => 'cases/cases_ListAllDelete');
     switch ($sTypeList) {
         case 'all':
             $c->add($c->getNewCriterion(AppThreadPeer::APP_THREAD_STATUS, 'OPEN')->addOr($c->getNewCriterion(ApplicationPeer::APP_STATUS, 'COMPLETED')->addAnd($c->getNewCriterion(AppDelegationPeer::DEL_PREVIOUS, 0))));
             $c->addDescendingOrderByColumn(ApplicationPeer::APP_NUMBER);
             break;
         case 'my_started':
             $oCriteria = new Criteria('workflow');
             $oCriteria->addSelectColumn(AppDelayPeer::APP_UID);
             $oCriteria->add($oCriteria->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, null, Criteria::ISNULL)->addOr($oCriteria->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, 0)));
             //$oCriteria->add(AppDelayPeer::APP_DISABLE_ACTION_USER, null, Criteria::ISNULL);
             $oDataset = AppDelayPeer::doSelectRS($oCriteria);
             $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
             $oDataset->next();
             $aProcesses = array();
             while ($aRow = $oDataset->getRow()) {
                 $aProcesses[] = $aRow['APP_UID'];
                 $oDataset->next();
             }
             $c->add($c->getNewCriterion(ApplicationPeer::APP_INIT_USER, $sUIDUserLogged));
             $c->add($c->getNewCriterion(AppThreadPeer::APP_THREAD_STATUS, 'OPEN')->addOr($c->getNewCriterion(ApplicationPeer::APP_STATUS, 'COMPLETED')->addAnd($c->getNewCriterion(AppDelegationPeer::DEL_PREVIOUS, 0))));
             $c->add($c->getNewCriterion(ApplicationPeer::APP_UID, $aProcesses, Criteria::NOT_IN));
             $c->addDescendingOrderByColumn(ApplicationPeer::APP_NUMBER);
             break;
         case 'to_do':
             $c->add(ApplicationPeer::APP_STATUS, 'TO_DO');
             $c->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL);
             $c->add(AppThreadPeer::APP_THREAD_STATUS, 'OPEN');
             $c->add(AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN');
             $c->addDescendingOrderByColumn(ApplicationPeer::APP_NUMBER);
             break;
         case 'draft':
             $c->add(ApplicationPeer::APP_STATUS, 'DRAFT');
             $c->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL);
             $c->add(AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN');
             $c->addDescendingOrderByColumn(ApplicationPeer::APP_NUMBER);
             break;
         case 'paused':
             $appDelayConds[] = array(ApplicationPeer::APP_UID, AppDelayPeer::APP_UID);
             $appDelayConds[] = array(AppDelegationPeer::DEL_INDEX, AppDelayPeer::APP_DEL_INDEX);
             $c->addJoinMC($appDelayConds, Criteria::LEFT_JOIN);
             $c->add(AppDelayPeer::APP_DELAY_UID, null, Criteria::ISNOTNULL);
             $c->add(AppDelayPeer::APP_TYPE, array("REASSIGN", "ADHOC", "CANCEL"), Criteria::NOT_IN);
             $c->add($c->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, null, Criteria::ISNULL)->addOr($c->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, 0)));
             $c->addDescendingOrderByColumn(ApplicationPeer::APP_NUMBER);
             break;
         case 'cancelled':
             $c->add($c->getNewCriterion(AppThreadPeer::APP_THREAD_STATUS, 'CLOSED')->addAnd($c->getNewCriterion(ApplicationPeer::APP_STATUS, 'CANCELLED')));
             $c->addDescendingOrderByColumn(ApplicationPeer::APP_NUMBER);
             break;
         case 'completed':
             $c->add(ApplicationPeer::APP_STATUS, 'COMPLETED');
             $c->add(AppDelegationPeer::DEL_PREVIOUS, '0', Criteria::NOT_EQUAL);
             //$c->addAsColumn('DEL_FINISH_DATE', 'max('.AppDelegationPeer::DEL_FINISH_DATE.')');
             $c->addGroupByColumn(ApplicationPeer::APP_UID);
             $c->addDescendingOrderByColumn(ApplicationPeer::APP_NUMBER);
             break;
         case 'gral':
             $c->add($c->getNewCriterion(AppThreadPeer::APP_THREAD_STATUS, 'OPEN')->addOr($c->getNewCriterion(ApplicationPeer::APP_STATUS, 'COMPLETED')->addAnd($c->getNewCriterion(AppDelegationPeer::DEL_PREVIOUS, 0))));
             $c->addDescendingOrderByColumn(ApplicationPeer::APP_NUMBER);
             $params = array();
             $sSql = BasePeer::createSelectSql($c, $params);
             break;
         case 'to_revise':
             $oCriteria = new Criteria('workflow');
             $oCriteria->add(ProcessUserPeer::USR_UID, $sUIDUserLogged);
             $oCriteria->add(ProcessUserPeer::PU_TYPE, 'SUPERVISOR');
             $oDataset = ProcessUserPeer::doSelectRS($oCriteria);
             $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
             $oDataset->next();
             $aProcesses = array();
             while ($aRow = $oDataset->getRow()) {
                 $aProcesses[] = $aRow['PRO_UID'];
                 $oDataset->next();
             }
             $c->add(ApplicationPeer::PRO_UID, $aProcesses, Criteria::IN);
             $c->add(ApplicationPeer::APP_STATUS, 'TO_DO');
             $c->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL);
             $c->add(AppThreadPeer::APP_THREAD_STATUS, 'OPEN');
             $c->add(AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN');
             $c->addDescendingOrderByColumn(ApplicationPeer::APP_NUMBER);
             break;
         case 'selfservice':
             //get the valid selfservice tasks for this user
             $oCase = new Cases();
             $tasks = $oCase->getSelfServiceTasks($_SESSION['USER_LOGGED']);
             $aTasks = array();
             foreach ($tasks as $key => $val) {
                 if (strlen(trim($val['uid'])) > 10) {
                     $aTasks[] = $val['uid'];
                 }
             }
             $c = new Criteria('workflow');
             $c->clearSelectColumns();
             $c->addSelectColumn(ApplicationPeer::APP_UID);
             $c->addSelectColumn(ApplicationPeer::APP_NUMBER);
             $c->addSelectColumn(ApplicationPeer::APP_UPDATE_DATE);
             $c->addSelectColumn(ApplicationPeer::PRO_UID);
             $c->addSelectColumn(ApplicationPeer::APP_INIT_USER);
             $c->addSelectColumn(AppDelegationPeer::DEL_PRIORITY);
             $c->addAsColumn('DEL_TASK_DUE_DATE', " IF (" . AppDelegationPeer::DEL_TASK_DUE_DATE . " <= NOW(),\n                    CONCAT('<span style=\\'color:red\\';>', " . AppDelegationPeer::DEL_TASK_DUE_DATE . ", '</span>'), " . AppDelegationPeer::DEL_TASK_DUE_DATE . ") ");
             $c->addSelectColumn(AppDelegationPeer::DEL_INDEX);
             $c->addSelectColumn(AppDelegationPeer::TAS_UID);
             $c->addSelectColumn(AppDelegationPeer::DEL_INIT_DATE);
             $c->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE);
             $c->addSelectColumn(UsersPeer::USR_UID);
             $c->addAsColumn('APP_CURRENT_USER', "CONCAT(USERS.USR_LASTNAME, ' ', USERS.USR_FIRSTNAME)");
             $c->addSelectColumn(ApplicationPeer::APP_STATUS);
             $c->addAsColumn('APP_TITLE', 'APP_TITLE.CON_VALUE');
             $c->addAsColumn('APP_PRO_TITLE', 'PRO_TITLE.CON_VALUE');
             $c->addAsColumn('APP_TAS_TITLE', 'TAS_TITLE.CON_VALUE');
             $c->addAlias("APP_TITLE", 'CONTENT');
             $c->addAlias("PRO_TITLE", 'CONTENT');
             $c->addAlias("TAS_TITLE", 'CONTENT');
             $c->addJoin(ApplicationPeer::APP_UID, AppDelegationPeer::APP_UID, Criteria::LEFT_JOIN);
             $c->addJoin(AppDelegationPeer::TAS_UID, TaskPeer::TAS_UID, Criteria::LEFT_JOIN);
             $appThreadConds[] = array(ApplicationPeer::APP_UID, AppThreadPeer::APP_UID);
             $appThreadConds[] = array(AppDelegationPeer::DEL_INDEX, AppThreadPeer::DEL_INDEX);
             $c->addJoinMC($appThreadConds, Criteria::LEFT_JOIN);
             $c->addJoin(AppDelegationPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN);
             $del = DBAdapter::getStringDelimiter();
             $appTitleConds = array();
             $appTitleConds[] = array(ApplicationPeer::APP_UID, 'APP_TITLE.CON_ID');
             $appTitleConds[] = array('APP_TITLE.CON_CATEGORY', $del . 'APP_TITLE' . $del);
             $appTitleConds[] = array('APP_TITLE.CON_LANG', $del . SYS_LANG . $del);
             $c->addJoinMC($appTitleConds, Criteria::LEFT_JOIN);
             //
             $proTitleConds = array();
             $proTitleConds[] = array(ApplicationPeer::PRO_UID, 'PRO_TITLE.CON_ID');
             $proTitleConds[] = array('PRO_TITLE.CON_CATEGORY', $del . 'PRO_TITLE' . $del);
             $proTitleConds[] = array('PRO_TITLE.CON_LANG', $del . SYS_LANG . $del);
             $c->addJoinMC($proTitleConds, Criteria::LEFT_JOIN);
             //
             $tasTitleConds = array();
             $tasTitleConds[] = array(AppDelegationPeer::TAS_UID, 'TAS_TITLE.CON_ID');
             $tasTitleConds[] = array('TAS_TITLE.CON_CATEGORY', $del . 'TAS_TITLE' . $del);
             $tasTitleConds[] = array('TAS_TITLE.CON_LANG', $del . SYS_LANG . $del);
             $c->addJoinMC($tasTitleConds, Criteria::LEFT_JOIN);
             $c->add(AppDelegationPeer::USR_UID, '');
             $c->add(AppDelegationPeer::TAS_UID, $aTasks, Criteria::IN);
             break;
         case 'to_reassign':
             $c->add($c->getNewCriterion(ApplicationPeer::APP_STATUS, 'TO_DO')->addOr($c->getNewCriterion(ApplicationPeer::APP_STATUS, 'DRAFT')));
             $c->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL);
             $c->add(AppThreadPeer::APP_THREAD_STATUS, 'OPEN');
             $c->add(AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN');
             $c->addDescendingOrderByColumn(ApplicationPeer::APP_NUMBER);
             break;
         case 'sent':
             $oCriteria = new Criteria('workflow');
             $oCriteria->addSelectColumn(AppDelayPeer::APP_UID);
             $oCriteria->add($oCriteria->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, null, Criteria::ISNULL)->addOr($oCriteria->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, 0)));
             $oDataset = AppDelayPeer::doSelectRS($oCriteria);
             $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
             $oDataset->next();
             $aProcesses = array();
             while ($aRow = $oDataset->getRow()) {
                 $aProcesses[] = $aRow['APP_UID'];
                 $oDataset->next();
             }
             if (isset($aAdditionalFilter) && isset($aAdditionalFilter['MINE'])) {
                 $c->add($c->getNewCriterion(ApplicationPeer::APP_INIT_USER, $sUIDUserLogged));
             } else {
                 $c->add($c->getNewCriterion(ApplicationPeer::APP_INIT_USER, $sUIDUserLogged)->addOr($c->getNewCriterion(AppDelegationPeer::USR_UID, $sUIDUserLogged)));
             }
             if (isset($aAdditionalFilter) && isset($aAdditionalFilter['APP_STATUS_FILTER'])) {
                 $c->add(ApplicationPeer::APP_STATUS, $sValue, Criteria::EQUAL);
             } else {
                 $c->add(ApplicationPeer::APP_STATUS, 'DRAFT', Criteria::NOT_EQUAL);
             }
             $c->add($c->getNewCriterion(AppDelegationPeer::DEL_THREAD_STATUS, 'CLOSED')->addOr($c->getNewCriterion(ApplicationPeer::APP_STATUS, 'COMPLETED')->addAnd($c->getNewCriterion(AppDelegationPeer::DEL_PREVIOUS, 0))));
             $c->add($c->getNewCriterion(ApplicationPeer::APP_UID, $aProcesses, Criteria::NOT_IN));
             $c->addDescendingOrderByColumn(ApplicationPeer::APP_NUMBER);
             break;
     }
     //select the xmlList to show
     if ($sTypeList == 'gral') {
         if ($RBAC->userCanAccess('PM_DELETECASE') == 1) {
             $xmlfile = $filesList['Alldelete'];
         } else {
             $xmlfile = $filesList['all'];
         }
     } else {
         $xmlfile = $filesList[$sTypeList];
     }
     if ($ClearSession) {
         //OPCION_1: claening the $_SESSION and updating the List.... only case List
         foreach ($filesList as $file) {
             $id = G::createUID('', $file . '.xml');
             unset($_SESSION['pagedTable[' . $id . ']']);
             unset($_SESSION[$id]);
         }
         //OPTION_2: cleaning the $_SESSION and whole List and xmls
         $cur = array_keys($_SESSION);
         foreach ($cur as $key) {
             if (substr($key, 0, 11) === "pagedTable[") {
                 unset($_SESSION[$key]);
             } else {
                 $xml = G::getUIDName($key, '');
                 if (strpos($xml, '.xml') !== false) {
                     unset($_SESSION[$key]);
                 }
             }
         }
     }
     return array($c, $xmlfile);
 }
Пример #9
0
 /**
  * gets the TO_REVISE cases list criteria
  * param $userUid the current userUid
  * param $doCount if true this will return the criteria for count cases only
  * @return Criteria object $Criteria
  */
 public function getToRevise($userUid, $doCount)
 {
     require_once 'classes/model/ProcessUser.php';
     //adding configuration fields from the configuration options
     //and forming the criteria object
     $oCriteria = new Criteria('workflow');
     $oCriteria->add(ProcessUserPeer::USR_UID, $userUid);
     $oCriteria->add(ProcessUserPeer::PU_TYPE, 'SUPERVISOR');
     $oDataset = ProcessUserPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $oDataset->next();
     $aProcesses = array();
     while ($aRow = $oDataset->getRow()) {
         $aProcesses[] = $aRow['PRO_UID'];
         $oDataset->next();
     }
     if ($doCount && !isset($this->confCasesList['PMTable']) && !empty($this->confCasesList['PMTable'])) {
         $c = new Criteria('workflow');
     } else {
         $c = $this->addPMFieldsToCriteria('todo');
     }
     $c->add(AppCacheViewPeer::PRO_UID, $aProcesses, Criteria::IN);
     $c->add(AppCacheViewPeer::APP_STATUS, 'TO_DO');
     $c->add(AppCacheViewPeer::DEL_FINISH_DATE, null, Criteria::ISNULL);
     $c->add(AppCacheViewPeer::APP_THREAD_STATUS, 'OPEN');
     $c->add(AppCacheViewPeer::DEL_THREAD_STATUS, 'OPEN');
     return $c;
 }
Пример #10
0
 public function deleteProcess($sProcessUID, $flagRemoveCases = true)
 {
     try {
         //G::LoadClass('case');
         //G::LoadClass('reportTables');
         //Instance all classes necesaries
         $oProcess = new \Process();
         $oDynaform = new \Dynaform();
         $oInputDocument = new \InputDocument();
         $oOutputDocument = new \OutputDocument();
         $oTrigger = new \Triggers();
         $oRoute = new \Route();
         $oGateway = new \Gateway();
         $oEvent = new \Event();
         $oSwimlaneElement = new \SwimlanesElements();
         $oConfiguration = new \Configuration();
         $oDbSource = new \DbSource();
         $oReportTable = new \ReportTables();
         $oCaseTracker = new \CaseTracker();
         $oCaseTrackerObject = new \CaseTrackerObject();
         //Update PROCESS_FILES_CHECKED
         $configuration = \ConfigurationPeer::retrieveByPK("PROCESS_FILES_CHECKED", "", "", "", "");
         if (!is_null($configuration)) {
             $arrayProjectUid = unserialize($configuration->getCfgValue());
             unset($arrayProjectUid[$sProcessUID]);
             $conf = new \Configuration();
             $result = $conf->update(array("CFG_UID" => "PROCESS_FILES_CHECKED", "OBJ_UID" => "", "CFG_VALUE" => serialize($arrayProjectUid), "PRO_UID" => "", "USR_UID" => "", "APP_UID" => ""));
         }
         //Delete the applications of process
         if ($flagRemoveCases) {
             $case = new \Cases();
             $criteria = new \Criteria("workflow");
             $criteria->addSelectColumn(\ApplicationPeer::APP_UID);
             $criteria->add(\ApplicationPeer::PRO_UID, $sProcessUID, \Criteria::EQUAL);
             $rsCriteria = \ApplicationPeer::doSelectRS($criteria);
             $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
             while ($rsCriteria->next()) {
                 $row = $rsCriteria->getRow();
                 $result = $case->removeCase($row["APP_UID"]);
             }
         }
         //Delete the tasks of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\TaskPeer::PRO_UID, $sProcessUID);
         $oDataset = \TaskPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             //$this->deleteTask($aRow['TAS_UID']);
             $oTasks = new \Tasks();
             $oTasks->deleteTask($aRow['TAS_UID']);
             $oDataset->next();
         }
         //Delete the dynaforms of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\DynaformPeer::PRO_UID, $sProcessUID);
         $oDataset = \DynaformPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oDynaform->remove($aRow['DYN_UID']);
             $oDataset->next();
         }
         //Delete the input documents of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\InputDocumentPeer::PRO_UID, $sProcessUID);
         $oDataset = \InputDocumentPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oInputDocument->remove($aRow['INP_DOC_UID']);
             $oDataset->next();
         }
         //Delete the output documents of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\OutputDocumentPeer::PRO_UID, $sProcessUID);
         $oDataset = \OutputDocumentPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oOutputDocument->remove($aRow['OUT_DOC_UID']);
             $oDataset->next();
         }
         //Delete the triggers of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\TriggersPeer::PRO_UID, $sProcessUID);
         $oDataset = \TriggersPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oTrigger->remove($aRow['TRI_UID']);
             $oDataset->next();
         }
         //Delete the routes of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\RoutePeer::PRO_UID, $sProcessUID);
         $oDataset = \RoutePeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oRoute->remove($aRow['ROU_UID']);
             $oDataset->next();
         }
         //Delete the gateways of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\GatewayPeer::PRO_UID, $sProcessUID);
         $oDataset = \GatewayPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oGateway->remove($aRow['GAT_UID']);
             $oDataset->next();
         }
         //Delete the Event of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\EventPeer::PRO_UID, $sProcessUID);
         $oDataset = \EventPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oEvent->remove($aRow['EVN_UID']);
             $oDataset->next();
         }
         //Delete the swimlanes elements of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\SwimlanesElementsPeer::PRO_UID, $sProcessUID);
         $oDataset = \SwimlanesElementsPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oSwimlaneElement->remove($aRow['SWI_UID']);
             $oDataset->next();
         }
         //Delete the configurations of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\ConfigurationPeer::PRO_UID, $sProcessUID);
         $oDataset = \ConfigurationPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oConfiguration->remove($aRow['CFG_UID'], $aRow['OBJ_UID'], $aRow['PRO_UID'], $aRow['USR_UID'], $aRow['APP_UID']);
             $oDataset->next();
         }
         //Delete the DB sources of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\DbSourcePeer::PRO_UID, $sProcessUID);
         $oDataset = \DbSourcePeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             /**
              * note added by gustavo cruz gustavo-at-colosa-dot-com 27-01-2010
              * in order to solve the bug 0004389, we use the validation function Exists
              * inside the remove function in order to verify if the DbSource record
              * exists in the Database, however there is a strange behavior within the
              * propel engine, when the first record is erased somehow the "_deleted"
              * attribute of the next row is set to true, so when propel tries to erase
              * it, obviously it can't and trows an error. With the "Exist" function
              * we ensure that if there is the record in the database, the _delete attribute must be false.
              *
              * note added by gustavo cruz gustavo-at-colosa-dot-com 28-01-2010
              * I have just identified the source of the issue, when is created a $oDbSource DbSource object
              * it's used whenever a record is erased or removed in the db, however the problem
              * it's that the same object is used every time, and the delete method invoked
              * sets the _deleted attribute to true when its called, of course as we use
              * the same object, the first time works fine but trowns an error with the
              * next record, cos it's the same object and the delete method checks if the _deleted
              * attribute it's true or false, the attrib _deleted is setted to true the
              * first time and later is never changed, the issue seems to be part of
              * every remove function in the model classes, not only DbSource
              * i recommend that a more general solution must be achieved to resolve
              * this issue in every model class, to prevent future problems.
              */
             $oDbSource->remove($aRow['DBS_UID'], $sProcessUID);
             $oDataset->next();
         }
         //Delete the supervisors
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\ProcessUserPeer::PRO_UID, $sProcessUID);
         \ProcessUserPeer::doDelete($oCriteria);
         //Delete the object permissions
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\ObjectPermissionPeer::PRO_UID, $sProcessUID);
         \ObjectPermissionPeer::doDelete($oCriteria);
         //Delete the step supervisors
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\StepSupervisorPeer::PRO_UID, $sProcessUID);
         \StepSupervisorPeer::doDelete($oCriteria);
         //Delete the report tables
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\ReportTablePeer::PRO_UID, $sProcessUID);
         $oDataset = \ReportTablePeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oReportTable->deleteReportTable($aRow['REP_TAB_UID']);
             $oDataset->next();
         }
         //Delete case tracker configuration
         $oCaseTracker->remove($sProcessUID);
         //Delete case tracker objects
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\CaseTrackerObjectPeer::PRO_UID, $sProcessUID);
         \ProcessUserPeer::doDelete($oCriteria);
         //Delete SubProcess
         $criteria = new \Criteria("workflow");
         $criteria->add(\SubProcessPeer::PRO_PARENT, $sProcessUID, \Criteria::EQUAL);
         $result = \SubProcessPeer::doDelete($criteria);
         //Delete WebEntries
         $webEntry = new \ProcessMaker\BusinessModel\WebEntry();
         $criteria = new \Criteria("workflow");
         $criteria->addSelectColumn(\WebEntryPeer::WE_UID);
         $criteria->add(\WebEntryPeer::PRO_UID, $sProcessUID, \Criteria::EQUAL);
         $rsCriteria = \WebEntryPeer::doSelectRS($criteria);
         $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         while ($rsCriteria->next()) {
             $row = $rsCriteria->getRow();
             $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 MessageTypes
         $messageType = new \ProcessMaker\BusinessModel\MessageType();
         $criteria = new \Criteria("workflow");
         $criteria->addSelectColumn(\MessageTypePeer::MSGT_UID);
         $criteria->add(\MessageTypePeer::PRJ_UID, $sProcessUID, \Criteria::EQUAL);
         $rsCriteria = \MessageTypePeer::doSelectRS($criteria);
         $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         while ($rsCriteria->next()) {
             $row = $rsCriteria->getRow();
             $messageType->delete($row["MSGT_UID"]);
         }
         //Delete Message-Event-Relation
         $messageEventRelation = new \ProcessMaker\BusinessModel\MessageEventRelation();
         $messageEventRelation->deleteWhere(array(\MessageEventRelationPeer::PRJ_UID => $sProcessUID));
         //Delete Message-Event-Task-Relation
         $elementTaskRelation = new \ProcessMaker\BusinessModel\ElementTaskRelation();
         $elementTaskRelation->deleteWhere(array(\ElementTaskRelationPeer::PRJ_UID => $sProcessUID));
         //Delete Message-Event-Definition
         $messageEventDefinition = new \ProcessMaker\BusinessModel\MessageEventDefinition();
         $criteria = new \Criteria("workflow");
         $criteria->addSelectColumn(\MessageEventDefinitionPeer::MSGED_UID);
         $criteria->add(\MessageEventDefinitionPeer::PRJ_UID, $sProcessUID, \Criteria::EQUAL);
         $rsCriteria = \MessageEventDefinitionPeer::doSelectRS($criteria);
         $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         while ($rsCriteria->next()) {
             $row = $rsCriteria->getRow();
             $messageEventDefinition->delete($row["MSGED_UID"]);
         }
         //Delete Script-Task
         $scriptTask = new \ProcessMaker\BusinessModel\ScriptTask();
         $scriptTask->deleteWhere(array(\ScriptTaskPeer::PRJ_UID => array($sProcessUID, \Criteria::EQUAL)));
         //Delete Timer-Event
         $timerEvent = new \ProcessMaker\BusinessModel\TimerEvent();
         $timerEvent->deleteWhere(array(\TimerEventPeer::PRJ_UID => array($sProcessUID, \Criteria::EQUAL)));
         //Delete Email-Event
         $emailEvent = new \ProcessMaker\BusinessModel\EmailEvent();
         $criteria = new \Criteria("workflow");
         $criteria->addSelectColumn(\EmailEventPeer::EMAIL_EVENT_UID);
         $criteria->add(\EmailEventPeer::PRJ_UID, $sProcessUID, \Criteria::EQUAL);
         $rsCriteria = \EmailEventPeer::doSelectRS($criteria);
         $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         while ($rsCriteria->next()) {
             $row = $rsCriteria->getRow();
             $emailEvent->delete($sProcessUID, $row["EMAIL_EVENT_UID"], false);
         }
         //Delete files Manager
         $filesManager = new \ProcessMaker\BusinessModel\FilesManager();
         $criteria = new \Criteria("workflow");
         $criteria->addSelectColumn(\ProcessFilesPeer::PRF_UID);
         $criteria->add(\ProcessFilesPeer::PRO_UID, $sProcessUID, \Criteria::EQUAL);
         $rsCriteria = \ProcessFilesPeer::doSelectRS($criteria);
         $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         while ($rsCriteria->next()) {
             $row = $rsCriteria->getRow();
             $filesManager->deleteProcessFilesManager($sProcessUID, $row["PRF_UID"]);
         }
         //Delete the actions by email
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\AbeConfigurationPeer::PRO_UID, $sProcessUID);
         \AbeConfigurationPeer::doDelete($oCriteria);
         //Delete the process
         try {
             $oProcess->remove($sProcessUID);
         } catch (\Exception $oError) {
             throw $oError;
         }
         return true;
     } catch (\Exception $oError) {
         throw $oError;
     }
 }
Пример #11
0
 /**
  * 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 = ProcessUserPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setPuUid($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setProUid($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setUsrUid($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setPuType($arr[$keys[3]]);
     }
 }
Пример #12
0
 /**
  * Delete Group
  *
  * @param string $groupUid Unique id of Group
  *
  * return void
  */
 public function delete($groupUid)
 {
     try {
         //Verify data
         $this->throwExceptionIfNotExistsGroup($groupUid, $this->arrayFieldNameForException["groupUid"]);
         $arrayTotalTasksByGroup = $this->getTotalTasksByGroup($groupUid);
         if (isset($arrayTotalTasksByGroup[$groupUid]) && $arrayTotalTasksByGroup[$groupUid] > 0) {
             throw new \Exception(\G::LoadTranslation("ID_GROUP_CANNOT_DELETE_WHILE_ASSIGNED_TO_TASK"));
         }
         //Delete
         $group = new \Groupwf();
         $result = $group->remove($groupUid);
         //Delete assignments of tasks
         $criteria = new \Criteria("workflow");
         $criteria->add(\TaskUserPeer::USR_UID, $groupUid);
         \TaskUserPeer::doDelete($criteria);
         //Delete permissions
         $criteria = new \Criteria("workflow");
         $criteria->add(\ObjectPermissionPeer::USR_UID, $groupUid);
         \ObjectPermissionPeer::doDelete($criteria);
         //Delete assignments of supervisors
         $criteria = new \Criteria("workflow");
         $criteria->add(\ProcessUserPeer::USR_UID, $groupUid);
         $criteria->add(\ProcessUserPeer::PU_TYPE, "GROUP_SUPERVISOR");
         \ProcessUserPeer::doDelete($criteria);
     } catch (\Exception $e) {
         throw $e;
     }
 }
Пример #13
0
 /**
  * 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(ProcessUserPeer::PU_UID, $pks, Criteria::IN);
         $objs = ProcessUserPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Пример #14
0
                $u = $user->load($data['USR_REPLACED_BY']);
                $c = new Configurations();
                $replaced_by = $c->usersNameFormat($u['USR_USERNAME'], $u['USR_FIRSTNAME'], $u['USR_LASTNAME']);
            } else {
                $replaced_by = '';
            }
            $misc = array();
            $misc['DEP_TITLE'] = $dep_name;
            $misc['REPLACED_NAME'] = $replaced_by;
            echo '{success: true, userdata: ' . G::json_encode($data) . ', cases: ' . G::json_encode($aCount) . ', misc: ' . G::json_encode($misc) . '}';
            break;
        case "verifyIfUserAssignedAsSupervisor":
            $supervisorUserUid = $_POST["supervisorUserUid"];
            $message = "OK";
            $criteria = new Criteria("workflow");
            $criteria->addSelectColumn(ProcessUserPeer::PU_UID);
            $criteria->add(ProcessUserPeer::USR_UID, $supervisorUserUid, Criteria::EQUAL);
            $criteria->add(ProcessUserPeer::PU_TYPE, "SUPERVISOR", Criteria::EQUAL);
            $rsCriteria = ProcessUserPeer::doSelectRS($criteria);
            $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            if ($rsCriteria->next()) {
                $message = "ERROR";
            }
            $response = array();
            $response["result"] = $message;
            echo G::json_encode($response);
            break;
    }
} catch (Exception $oException) {
    die($oException->getMessage());
}
Пример #15
0
 /**
  * Remove a supervisor
  *
  * @param string $sProcessUID
  * @param string $sPuUID
  * @access public
  */
 public function removeProcessSupervisor($sProcessUID, $sPuUID)
 {
     $oConnection = \Propel::getConnection(\ProcessUserPeer::DATABASE_NAME);
     try {
         $oProcessUser = \ProcessUserPeer::retrieveByPK($sPuUID);
         if (!is_null($oProcessUser)) {
             $oConnection->begin();
             $iResult = $oProcessUser->delete();
             $oConnection->commit();
             return $iResult;
         } else {
             throw new \Exception(\G::LoadTranslation("ID_ROW_DOES_NOT_EXIST"));
         }
     } catch (\Exception $e) {
         $oConnection->rollback();
         throw $e;
     }
 }
Пример #16
0
    /**

     * Get "Process User" (Groups) records of a Process

     *

     * @param string $processUid Unique id of Process

     *

     * return array Return an array with all "Process User" (Groups)

     */

    public function getProcessUser($processUid)

    {

        try {

            $arrayProcessUser = array();



            //Get data

            $criteria = new Criteria("workflow");



            $criteria->add(ProcessUserPeer::PRO_UID, $processUid, Criteria::EQUAL);

            $criteria->add(ProcessUserPeer::PU_TYPE, "GROUP_SUPERVISOR", Criteria::EQUAL);



            $rsCriteria = ProcessUserPeer::doSelectRS($criteria);

            $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);



            while ($rsCriteria->next()) {

                $row = $rsCriteria->getRow();



                //Verify group status

                $criteria2 = new Criteria("workflow");



                $criteria2->add(GroupwfPeer::GRP_UID, $row["USR_UID"], Criteria::EQUAL);

                $criteria2->add(GroupwfPeer::GRP_STATUS, "ACTIVE", Criteria::EQUAL);



                $rsCriteria2 = GroupwfPeer::doSelectRS($criteria2);



                if ($rsCriteria2->next()) {

                    $arrayProcessUser[] = $row;

                }

            }



            //Return

            return $arrayProcessUser;

        } catch (Exception $e) {

            throw $e;

        }

    }
Пример #17
0
     require_once 'classes/model/TaskUser.php';
     $oProcess = new TaskUser();
     $oCriteria = new Criteria('workflow');
     $oCriteria->add(TaskUserPeer::USR_UID, $_POST['GRP_UID']);
     TaskUserPeer::doDelete($oCriteria);
     //Delete permissions
     require_once 'classes/model/ObjectPermission.php';
     $criteria = new Criteria('workflow');
     $criteria->add(ObjectPermissionPeer::USR_UID, $_POST['GRP_UID']);
     ObjectPermissionPeer::doDelete($criteria);
     //Delete supervisors assignments
     require_once 'classes/model/ProcessUser.php';
     $criteria = new Criteria('workflow');
     $criteria->add(ProcessUserPeer::USR_UID, $_POST['GRP_UID']);
     $criteria->add(ProcessUserPeer::PU_TYPE, 'GROUP_SUPERVISOR');
     ProcessUserPeer::doDelete($criteria);
     echo '{success: true}';
     break;
 case 'assignedMembers':
     require_once 'classes/model/Users.php';
     require_once 'classes/model/GroupUser.php';
     G::LoadClass('configuration');
     $co = new Configurations();
     $config = $co->getConfiguration('groupList', 'pageSize', '', $_SESSION['USER_LOGGED']);
     $env = $co->getConfiguration('ENVIRONMENT_SETTINGS', '');
     $limit_size = isset($config['pageSize']) ? $config['pageSize'] : 20;
     $start = isset($_REQUEST['start']) ? $_REQUEST['start'] : 0;
     $limit = isset($_REQUEST['limit']) ? $_REQUEST['limit'] : $limit_size;
     $filter = isset($_REQUEST['textFilter']) ? $_REQUEST['textFilter'] : '';
     $sGroupUID = $_REQUEST['gUID'];
     $aUsers = array();
Пример #18
0
    /**
     * Delete Process
     *
     * @param string $processUid
     * @param bool   $checkCases
     *
     * return bool   Return true, if is succesfully
     *
     * @access public

    DEPRECATED
    public function deleteProcess($processUid, $checkCases = true)
    {
        if ($checkCases) {
            $process = new \Process();

            $arrayCases = $process->getCasesCountInAllProcesses($processUid);

            $sum = 0;

            if (isset($arrayCases[$processUid]) && count($arrayCases[$processUid]) > 0) {
                foreach ($arrayCases[$processUid] as $value) {
                    $sum = $sum + $value;
                }
            }

            if ($sum > 0) {
                throw (new \Exception("You can't delete the process, because it has $sum cases"));
            }
        }

        $processMap = new \processMap();

        return $processMap->deleteProcess($processUid);

    }*/

    public function deleteProcess($sProcessUID)
    {
        try {
            G::LoadClass('case');
            G::LoadClass('reportTables');
            //Instance all classes necesaries
            $oProcess = new Process();
            $oDynaform = new Dynaform();
            $oInputDocument = new InputDocument();
            $oOutputDocument = new OutputDocument();
            $oTrigger = new Triggers();
            $oRoute = new Route();
            $oGateway = new Gateway();
            $oEvent = new Event();
            $oSwimlaneElement = new SwimlanesElements();
            $oConfiguration = new Configuration();
            $oDbSource = new DbSource();
            $oReportTable = new ReportTables();
            $oCaseTracker = new CaseTracker();
            $oCaseTrackerObject = new CaseTrackerObject();
            //Delete the applications of process
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(ApplicationPeer::PRO_UID, $sProcessUID);
            $oDataset = ApplicationPeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            $oCase = new Cases();
            while ($aRow = $oDataset->getRow()) {
                $oCase->removeCase($aRow['APP_UID']);
                $oDataset->next();
            }
            //Delete the tasks of process
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(TaskPeer::PRO_UID, $sProcessUID);
            $oDataset = TaskPeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            while ($aRow = $oDataset->getRow()) {
                $this->deleteTask($aRow['TAS_UID']);
                $oDataset->next();
            }
            //Delete the dynaforms of process
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(DynaformPeer::PRO_UID, $sProcessUID);
            $oDataset = DynaformPeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            while ($aRow = $oDataset->getRow()) {
                $oDynaform->remove($aRow['DYN_UID']);
                $oDataset->next();
            }
            //Delete the input documents of process
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(InputDocumentPeer::PRO_UID, $sProcessUID);
            $oDataset = InputDocumentPeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            while ($aRow = $oDataset->getRow()) {
                $oInputDocument->remove($aRow['INP_DOC_UID']);
                $oDataset->next();
            }
            //Delete the output documents of process
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(OutputDocumentPeer::PRO_UID, $sProcessUID);
            $oDataset = OutputDocumentPeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            while ($aRow = $oDataset->getRow()) {
                $oOutputDocument->remove($aRow['OUT_DOC_UID']);
                $oDataset->next();
            }

            //Delete the triggers of process
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(TriggersPeer::PRO_UID, $sProcessUID);
            $oDataset = TriggersPeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            while ($aRow = $oDataset->getRow()) {
                $oTrigger->remove($aRow['TRI_UID']);
                $oDataset->next();
            }

            //Delete the routes of process
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(RoutePeer::PRO_UID, $sProcessUID);
            $oDataset = RoutePeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            while ($aRow = $oDataset->getRow()) {
                $oRoute->remove($aRow['ROU_UID']);
                $oDataset->next();
            }

            //Delete the gateways of process
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(GatewayPeer::PRO_UID, $sProcessUID);
            $oDataset = GatewayPeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            while ($aRow = $oDataset->getRow()) {
                $oGateway->remove($aRow['GAT_UID']);
                $oDataset->next();
            }

            //Delete the Event of process
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(EventPeer::PRO_UID, $sProcessUID);
            $oDataset = EventPeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            while ($aRow = $oDataset->getRow()) {
                $oEvent->remove($aRow['EVN_UID']);
                $oDataset->next();
            }

            //Delete the swimlanes elements of process
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(SwimlanesElementsPeer::PRO_UID, $sProcessUID);
            $oDataset = SwimlanesElementsPeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            while ($aRow = $oDataset->getRow()) {
                $oSwimlaneElement->remove($aRow['SWI_UID']);
                $oDataset->next();
            }
            //Delete the configurations of process
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(ConfigurationPeer::PRO_UID, $sProcessUID);
            $oDataset = ConfigurationPeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            while ($aRow = $oDataset->getRow()) {
                $oConfiguration->remove($aRow['CFG_UID'], $aRow['OBJ_UID'], $aRow['PRO_UID'], $aRow['USR_UID'], $aRow['APP_UID']);
                $oDataset->next();
            }
            //Delete the DB sources of process
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(DbSourcePeer::PRO_UID, $sProcessUID);
            $oDataset = DbSourcePeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            while ($aRow = $oDataset->getRow()) {

                /**
                 * note added by gustavo cruz gustavo-at-colosa-dot-com 27-01-2010
                 * in order to solve the bug 0004389, we use the validation function Exists
                 * inside the remove function in order to verify if the DbSource record
                 * exists in the Database, however there is a strange behavior within the
                 * propel engine, when the first record is erased somehow the "_deleted"
                 * attribute of the next row is set to true, so when propel tries to erase
                 * it, obviously it can't and trows an error. With the "Exist" function
                 * we ensure that if there is the record in the database, the _delete attribute must be false.
                 *
                 * note added by gustavo cruz gustavo-at-colosa-dot-com 28-01-2010
                 * I have just identified the source of the issue, when is created a $oDbSource DbSource object
                 * it's used whenever a record is erased or removed in the db, however the problem
                 * it's that the same object is used every time, and the delete method invoked
                 * sets the _deleted attribute to true when its called, of course as we use
                 * the same object, the first time works fine but trowns an error with the
                 * next record, cos it's the same object and the delete method checks if the _deleted
                 * attribute it's true or false, the attrib _deleted is setted to true the
                 * first time and later is never changed, the issue seems to be part of
                 * every remove function in the model classes, not only DbSource
                 * i recommend that a more general solution must be achieved to resolve
                 * this issue in every model class, to prevent future problems.
                 */
                $oDbSource->remove($aRow['DBS_UID'], $sProcessUID);
                $oDataset->next();
            }
            //Delete the supervisors
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(ProcessUserPeer::PRO_UID, $sProcessUID);
            ProcessUserPeer::doDelete($oCriteria);
            //Delete the object permissions
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(ObjectPermissionPeer::PRO_UID, $sProcessUID);
            ObjectPermissionPeer::doDelete($oCriteria);
            //Delete the step supervisors
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(StepSupervisorPeer::PRO_UID, $sProcessUID);
            StepSupervisorPeer::doDelete($oCriteria);
            //Delete the report tables
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(ReportTablePeer::PRO_UID, $sProcessUID);
            $oDataset = ReportTablePeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            while ($aRow = $oDataset->getRow()) {
                $oReportTable->deleteReportTable($aRow['REP_TAB_UID']);
                $oDataset->next();
            }
            //Delete case tracker configuration
            $oCaseTracker->remove($sProcessUID);
            //Delete case tracker objects
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(CaseTrackerObjectPeer::PRO_UID, $sProcessUID);
            ProcessUserPeer::doDelete($oCriteria);
            //Delete the process
            try {
                $oProcess->remove($sProcessUID);
            } catch (Exception $oError) {
                throw ($oError);
            }
            return true;
        } catch (Exception $oError) {
            throw ($oError);
        }
    }