Ejemplo n.º 1
0
 /**
  * Delete a task
  * @param string $sTaskUID
  * @return void
  */
 function deleteTask($sTaskUID = '')
 {
     try {
         //Instance classes
         $oTask = new Task();
         $oTasks = new Tasks();
         $oTaskUser = new TaskUser();
         $oStep = new Step();
         $oStepTrigger = new StepTrigger();
         //Get task information
         $aFields = $oTask->load($sTaskUID);
         //Delete routes
         $oTasks->deleteAllRoutesOfTask($aFields['PRO_UID'], $sTaskUID, true);
         //Delete gateways
         $oTasks->deleteAllGatewayOfTask($aFields['PRO_UID'], $sTaskUID, true);
         //Delete the users assigned to task
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(TaskUserPeer::TAS_UID, $sTaskUID);
         $oDataset1 = TaskUserPeer::doSelectRS($oCriteria);
         $oDataset1->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset1->next();
         while ($aRow1 = $oDataset1->getRow()) {
             $oTaskUser->remove($aRow1['TAS_UID'], $aRow1['USR_UID'], $aRow1['TU_TYPE'], $aRow1['TU_RELATION']);
             $oDataset1->next();
         }
         //Delete the steps of task
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(StepPeer::TAS_UID, $sTaskUID);
         $oDataset1 = StepPeer::doSelectRS($oCriteria);
         $oDataset1->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset1->next();
         while ($aRow1 = $oDataset1->getRow()) {
             //Delete the triggers assigned to step
             /*$oCriteria = new Criteria('workflow');
               $oCriteria->add(StepTriggerPeer::STEP_UID, $aRow1['STEP_UID']);
               $oDataset2 = StepTriggerPeer::doSelectRS($oCriteria);
               $oDataset2->setFetchmode(ResultSet::FETCHMODE_ASSOC);
               $oDataset2->next();
               while ($aRow2 = $oDataset2->getRow()) {
                 $oStepTrigger->remove($aRow2['STEP_UID'], $aRow2['TAS_UID'], $aRow2['TRI_UID'], $aRow2['ST_TYPE']);
                 $oDataset2->next();
               }*/
             $oStep->remove($aRow1['STEP_UID']);
             $oDataset1->next();
         }
         //Delete step triggers
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(StepTriggerPeer::TAS_UID, $sTaskUID);
         StepTriggerPeer::doDelete($oCriteria);
         //Delete permissions
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(ObjectPermissionPeer::TAS_UID, $sTaskUID);
         ObjectPermissionPeer::doDelete($oCriteria);
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(ObjectPermissionPeer::OP_TASK_SOURCE, $sTaskUID);
         ObjectPermissionPeer::doDelete($oCriteria);
         //Delete task
         $oTask->remove($sTaskUID);
         //Delete cases schedulers added by krlos
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(CaseSchedulerPeer::TAS_UID, $sTaskUID);
         CaseSchedulerPeer::doDelete($oCriteria);
     } catch (Exception $oError) {
         throw $oError;
     }
 }
Ejemplo n.º 2
0
                 $titleNextTask=G::LoadTranslation("ID_END_OF_PROCESS");
             }
             G::auditLog("DerivationRule",'PROCESS NAME : '.$titleProcess.' : '.$oData->pro_uid.' Routing rule : '.$sType.' from -> '.$titleTask.' : '.$oData->tas_uid.' To -> '.$titleNextTask.' : '.$oData->next_task);
             break;
     }
     if (($oData->type != 0) && ($oData->type != 5) && ($oData->type != 8)) {
         if ($oProcessMap->getNumberOfRoutes($oData->pro_uid, $oData->tas_uid, $oData->next_task, $sType) > 0) {
             die();
         }
         unset($aRow);
     }
     if (($oData->delete) || ($oData->type == 0) || ($oData->type == 5) || ($oData->type == 8)) {
         G::LoadClass('tasks');
         $oTasks = new Tasks();
         $oTasks->deleteAllRoutesOfTask($oData->pro_uid, $oData->tas_uid);
         $oTasks->deleteAllGatewayOfTask($oData->pro_uid, $oData->tas_uid);
     }
     $oProcessMap->saveNewPattern($oData->pro_uid, $oData->tas_uid, $oData->next_task, $sType, $oData->delete);
     break;
 case 'deleteAllRoutes':
     G::LoadClass('tasks');
     $oTaskNewPattern = new Task();
     $taskInfo=$oTaskNewPattern->load($oData->tas_uid);
     $titleTask=$taskInfo['TAS_TITLE'];
     G::auditlog("DeleteRoutes",'Delete All Routes From Task -> '.$titleTask.' : '.$oData->tas_uid);
     $oTasks = new Tasks();
     $oTasks->deleteAllRoutesOfTask($oData->pro_uid, $oData->tas_uid);
     break;
 case 'objectPermissions':
     $oProcessMap->objectsPermissionsList($oData->pro_uid);
     break;
Ejemplo n.º 3
0
    /**
     * Create Route
     *
     * @param string $processUid
     * @param string $taskUid
     * @param string $nextTaskUid
     * @param string $type
     * @param bool   $delete
     *
     * return string Return UID of new Route
     *
     * @access public
     */
    public function defineRoute($processUid, $taskUid, $nextTaskUid, $type, $delete = false)
    {
        //Copy of processmaker/workflow/engine/methods/processes/processes_Ajax.php //case 'saveNewPattern':

        $processMap = new \processMap();

        if ($type != "SEQUENTIAL" && $type != "SEC-JOIN" && $type != "DISCRIMINATOR") {
            if ($processMap->getNumberOfRoutes($processUid, $taskUid, $nextTaskUid, $type) > 0) {
                //die();
                throw (new \Exception());
            }

            //unset($aRow);
        }

        if ($delete || $type == "SEQUENTIAL" || $type == "SEC-JOIN" || $type == "DISCRIMINATOR") {
            //\G::LoadClass("tasks");

            $tasks = new \Tasks();

            $tasks->deleteAllRoutesOfTask($processUid, $taskUid);
            $tasks->deleteAllGatewayOfTask($processUid, $taskUid);
        }

        return $processMap->saveNewPattern($processUid, $taskUid, $nextTaskUid, $type, $delete);
    }