public function getAllInputDocsByTask($sPRO_UID)
 {
     $oCriteria = new Criteria('workflow');
     $oCriteria->addSelectColumn(StepPeer::STEP_UID_OBJ);
     $oCriteria->addSelectColumn('COUNT(*) AS CNT');
     $oCriteria->addGroupByColumn(StepPeer::STEP_UID_OBJ);
     $oCriteria->add(StepPeer::STEP_TYPE_OBJ, 'INPUT_DOCUMENT');
     $oCriteria->add(StepPeer::PRO_UID, $sPRO_UID);
     $oDataset = StepPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $aIDocs = array();
     while ($oDataset->next()) {
         $row = $oDataset->getRow();
         $aIDocs[$row['STEP_UID_OBJ']] = $row['CNT'];
     }
     return $aIDocs;
 }
 $oCriteria->addAscendingOrderByColumn(AppDelegationPeer::DEL_INDEX);
 $oDataset = AppDelegationPeer::doSelectRS($oCriteria);
 $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
 $oDataset->next();
 $oTask = new Tasks();
 $aDynaforms = array();
 while ($aRow = $oDataset->getRow()) {
     $aSteps = $oTask->getStepsOfTask($aRow['TAS_UID']);
     if (is_array($aSteps)) {
         foreach ($aSteps as $key => $value) {
             $oCriteriaStep = new Criteria('workflow');
             $oCriteriaStep->addSelectColumn(StepPeer::STEP_UID_OBJ);
             $sStepId = isset($value['STEP_UID']) ? $value['STEP_UID'] : 0;
             $oCriteriaStep->add(StepPeer::STEP_UID, $sStepId, CRITERIA::EQUAL);
             $oCriteriaStep->add(StepPeer::STEP_TYPE_OBJ, 'DYNAFORM', CRITERIA::EQUAL);
             $oDataSetStep = StepPeer::doSelectRS($oCriteriaStep);
             $oDataSetStep->setFetchmode(ResultSet::FETCHMODE_ASSOC);
             $oDataSetStep->next();
             $aRows = $oDataSetStep->getRow();
             if (is_array($aRows) && !in_array($aRows['STEP_UID_OBJ'], $aDynaforms)) {
                 $aDynaforms[] = $aRows['STEP_UID_OBJ'];
             }
         }
         unset($value);
     }
     $oDataset->next();
 }
 if (count($aDynaforms) > 0) {
     require_once "classes/model/Dynaform.php";
     $dynInstance = new Dynaform();
     foreach ($aDynaforms as $key => $value) {
Esempio n. 3
0
    /**
     * Verify if not exists OuputDocument in Steps
     *
     * @param string $applicationUid Unique id of Case
     * @param string $delIndex       Delegation index
     * @param string $outDocUuid
     *
     * return void Throw exception if not exists OuputDocument in Steps
     */
    public function throwExceptionIfOuputDocumentNotExistsInSteps($applicacionUid, $delIndex, $outputDocumentUid)
    {
        try {
            //Verify data
            $appDelegation = \AppDelegationPeer::retrieveByPK($applicacionUid, $delIndex);

            $taskUid = $appDelegation->getTasUid();

            $criteria = new \Criteria("workflow");

            $criteria->addSelectColumn(\StepPeer::STEP_UID);

            $criteria->add(\StepPeer::TAS_UID, $taskUid, \Criteria::EQUAL);
            $criteria->add(\StepPeer::STEP_TYPE_OBJ, "OUTPUT_DOCUMENT", \Criteria::EQUAL);
            $criteria->add(\StepPeer::STEP_UID_OBJ, $outputDocumentUid, \Criteria::EQUAL);

            $rsCriteria = \StepPeer::doSelectRS($criteria);
            $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);

            if (!$rsCriteria->next()) {
                throw new \Exception(\G::LoadTranslation("ID_CASES_OUTPUT_DOES_NOT_EXIST", array($outputDocumentUid)));
            }
        } catch (\Exception $e) {
            throw $e;
        }
    }
Esempio n. 4
0
 public function loadTriggers($sTasUid, $sStepType, $sStepUidObj, $sTriggerType)
 {
     $aTriggers = array();
     if ($sStepUidObj != -1 && $sStepUidObj != -2) {
         $c = new Criteria();
         $c->clearSelectColumns();
         $c->addSelectColumn(StepPeer::STEP_UID);
         $c->add(StepPeer::TAS_UID, $sTasUid);
         $c->add(StepPeer::STEP_TYPE_OBJ, $sStepType);
         $c->add(StepPeer::STEP_UID_OBJ, $sStepUidObj);
         $rs = StepPeer::doSelectRS($c);
         $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $rs->next();
         $row = $rs->getRow();
         $sStepUid = $row['STEP_UID'];
     } else {
         $sStepUid = $sStepUidObj;
     }
     $c = new Criteria();
     $c->clearSelectColumns();
     $c->addSelectColumn(TriggersPeer::TRI_UID);
     $c->addSelectColumn(StepTriggerPeer::ST_CONDITION);
     $c->addSelectColumn(TriggersPeer::TRI_TYPE);
     $c->addSelectColumn(TriggersPeer::TRI_WEBBOT);
     $c->add(StepTriggerPeer::STEP_UID, $sStepUid);
     $c->add(StepTriggerPeer::TAS_UID, $sTasUid);
     $c->add(StepTriggerPeer::ST_TYPE, $sTriggerType);
     $c->addJoin(StepTriggerPeer::TRI_UID, TriggersPeer::TRI_UID, Criteria::LEFT_JOIN);
     $c->addAscendingOrderByColumn(StepTriggerPeer::ST_POSITION);
     $rs = TriggersPeer::doSelectRS($c);
     $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $rs->next();
     $row = $rs->getRow();
     while (is_array($row)) {
         $aTriggers[] = $row;
         $rs->next();
         $row = $rs->getRow();
     }
     return $aTriggers;
 }
Esempio n. 5
0
 /**
  * Verify if the InputDocument it's assigned in other objects
  *
  * @param string $inputDocumentUid Unique id of InputDocument
  *
  * return array Return array (true if it's assigned or false otherwise and data)
  */
 public function itsAssignedInOtherObjects($inputDocumentUid)
 {
     try {
         $flagAssigned = false;
         $arrayData = array();
         //Step
         $criteria = new \Criteria("workflow");
         $criteria->addSelectColumn(\StepPeer::STEP_UID);
         $criteria->add(\StepPeer::STEP_TYPE_OBJ, "INPUT_DOCUMENT", \Criteria::EQUAL);
         $criteria->add(\StepPeer::STEP_UID_OBJ, $inputDocumentUid, \Criteria::EQUAL);
         $rsCriteria = \StepPeer::doSelectRS($criteria);
         if ($rsCriteria->next()) {
             $flagAssigned = true;
             $arrayData[] = \G::LoadTranslation("ID_STEPS");
         }
         //StepSupervisor
         $criteria = new \Criteria("workflow");
         $criteria->addSelectColumn(\StepSupervisorPeer::STEP_UID);
         $criteria->add(\StepSupervisorPeer::STEP_TYPE_OBJ, "INPUT_DOCUMENT", \Criteria::EQUAL);
         $criteria->add(\StepSupervisorPeer::STEP_UID_OBJ, $inputDocumentUid, \Criteria::EQUAL);
         $rsCriteria = \StepSupervisorPeer::doSelectRS($criteria);
         if ($rsCriteria->next()) {
             $flagAssigned = true;
             $arrayData[] = \G::LoadTranslation("ID_CASES_MENU_ADMIN");
         }
         //ObjectPermission
         $criteria = new \Criteria("workflow");
         $criteria->addSelectColumn(\ObjectPermissionPeer::OP_UID);
         $criteria->add(\ObjectPermissionPeer::OP_OBJ_TYPE, "INPUT", \Criteria::EQUAL);
         $criteria->add(\ObjectPermissionPeer::OP_OBJ_UID, $inputDocumentUid, \Criteria::EQUAL);
         $rsCriteria = \ObjectPermissionPeer::doSelectRS($criteria);
         if ($rsCriteria->next()) {
             $flagAssigned = true;
             $arrayData[] = \G::LoadTranslation("ID_PROCESS_PERMISSIONS");
         }
         //Return
         return array($flagAssigned, $arrayData);
     } catch (\Exception $e) {
         throw $e;
     }
 }
Esempio n. 6
0
 /**
  * Execute Trigger case
  *
  */
 public function doExecuteTriggerCase($usr_uid, $prj_uid, $act_uid, $cas_uid, $step_uid, $type)
 {
     $userData = $this->getUserData($usr_uid);
     $c = new \Criteria();
     $c->clearSelectColumns();
     $c->addSelectColumn(\StepPeer::STEP_UID);
     $c->addSelectColumn(\StepPeer::STEP_UID_OBJ);
     $c->add(\StepPeer::TAS_UID, $act_uid);
     $c->add(\StepPeer::STEP_TYPE_OBJ, 'DYNAFORM');
     $c->add(\StepPeer::STEP_UID, $step_uid);
     $rs = \StepPeer::doSelectRS($c);
     $rs->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
     $rs->next();
     $row = $rs->getRow();
     $step_uid_obj = $row['STEP_UID_OBJ'];
     $oCase = new \Cases();
     $Fields = $oCase->loadCase($cas_uid);
     $_SESSION["APPLICATION"] = $cas_uid;
     $_SESSION["PROCESS"] = $prj_uid;
     $_SESSION["TASK"] = $act_uid;
     $_SESSION["USER_LOGGED"] = $usr_uid;
     $_SESSION["USR_USERNAME"] = $userData['firstName'];
     $_SESSION["INDEX"] = $Fields["DEL_INDEX"] = \AppDelegation::getCurrentIndex($cas_uid);
     $Fields['APP_DATA'] = array_merge($Fields['APP_DATA'], G::getSystemConstants());
     $triggers = $oCase->loadTriggers($act_uid, 'DYNAFORM', $step_uid_obj, strtoupper($type));
     if ($triggers) {
         $Fields['APP_DATA'] = $oCase->ExecuteTriggers($act_uid, 'DYNAFORM', $step_uid_obj, strtoupper($type), $Fields['APP_DATA']);
     }
     $Fields['TAS_UID'] = $act_uid;
     $Fields['CURRENT_DYNAFORM'] = $step_uid_obj;
     $Fields['USER_UID'] = $usr_uid;
     $Fields['PRO_UID'] = $prj_uid;
     $oCase->updateCase($cas_uid, $Fields);
     $response = array('status' => 'ok');
     return $response;
 }
Esempio n. 7
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 = StepPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setStepUid($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setProUid($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setTasUid($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setStepTypeObj($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setStepUidObj($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setStepCondition($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setStepPosition($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setStepMode($arr[$keys[7]]);
     }
 }
Esempio n. 8
0
    /**

     * this function remove all Process except the PROCESS ROW

     *

     * @param string $sProUid

     * @return boolean

     */

    public function removeProcessRows ($sProUid)

    {

        try {

            //Instance all classes necesaries

            $oProcess = new Process();

            $oDynaform = new Dynaform();

            $oInputDocument = new InputDocument();

            $oOutputDocument = new OutputDocument();

            $oTrigger = new Triggers();

            $oStepTrigger = new StepTrigger();

            $oRoute = new Route();

            $oStep = new Step();

            $oSubProcess = new SubProcess();

            $oCaseTracker = new CaseTracker();

            $oCaseTrackerObject = new CaseTrackerObject();

            $oObjectPermission = new ObjectPermission();

            $oSwimlaneElement = new SwimlanesElements();

            $oConnection = new DbSource();

            $oStage = new Stage();

            $oEvent = new Event();

            $oCaseScheduler = new CaseScheduler();

            $oConfig = new Configuration();



            //Delete the tasks of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( TaskPeer::PRO_UID, $sProUid );

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

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

            $oDataset->next();

            $oTask = new Task();

            while ($aRow = $oDataset->getRow()) {

                $oCriteria = new Criteria( 'workflow' );

                $oCriteria->add( StepTriggerPeer::TAS_UID, $aRow['TAS_UID'] );

                StepTriggerPeer::doDelete( $oCriteria );

                if ($oTask->taskExists( $aRow['TAS_UID'] )) {

                    $oTask->remove( $aRow['TAS_UID'] );

                }

                $oDataset->next();

            }



            //Delete the dynaforms of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( DynaformPeer::PRO_UID, $sProUid );

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

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

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                $sWildcard = PATH_DYNAFORM . $aRow['PRO_UID'] . PATH_SEP . $aRow['DYN_UID'] . '_tmp*';

                foreach (glob( $sWildcard ) as $fn) {

                    @unlink( $fn );

                }

                $sWildcard = PATH_DYNAFORM . $aRow['PRO_UID'] . PATH_SEP . $aRow['DYN_UID'] . '.*';

                foreach (glob( $sWildcard ) as $fn) {

                    @unlink( $fn );

                }

                if ($oDynaform->dynaformExists( $aRow['DYN_UID'] )) {

                    $oDynaform->remove( $aRow['DYN_UID'] );

                }

                $oDataset->next();

            }



            //Delete the input documents of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( InputDocumentPeer::PRO_UID, $sProUid );

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

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

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oInputDocument->InputExists( $aRow['INP_DOC_UID'] )) {

                    $oInputDocument->remove( $aRow['INP_DOC_UID'] );

                }

                $oDataset->next();

            }



            //Delete the output documents of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( OutputDocumentPeer::PRO_UID, $sProUid );

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

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

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oOutputDocument->OutputExists( $aRow['OUT_DOC_UID'] )) {

                    $oOutputDocument->remove( $aRow['OUT_DOC_UID'] );

                }

                $oDataset->next();

            }



            //Delete the steps

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( StepPeer::PRO_UID, $sProUid );

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

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

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                //Delete the steptrigger of process

                /*$oCriteria = new Criteria('workflow');

                  $oCriteria->add(StepTriggerPeer::STEP_UID, $aRow['STEP_UID']);

                  $oDataseti = StepTriggerPeer::doSelectRS($oCriteria);

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

                  $oDataseti->next();

                  while ($aRowi = $oDataseti->getRow()) {

                  if ($oStepTrigger->stepTriggerExists($aRowi['STEP_UID'], $aRowi['TAS_UID'], $aRowi['TRI_UID'], $aRowi['ST_TYPE']))

                  $oStepTrigger->remove($aRowi['STEP_UID'], $aRowi['TAS_UID'], $aRowi['TRI_UID'], $aRowi['ST_TYPE']);

                  $oDataseti->next();

                  }*/

                $oStep->remove( $aRow['STEP_UID'] );

                $oDataset->next();

            }



            //Delete the StepSupervisor

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( StepSupervisorPeer::PRO_UID, $sProUid );

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

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

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oStep->StepExists( $aRow['STEP_UID'] )) {

                    $oStep->remove( $aRow['STEP_UID'] );

                }

                $oDataset->next();

            }



            //Delete the triggers of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( TriggersPeer::PRO_UID, $sProUid );

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

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

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oTrigger->TriggerExists( $aRow['TRI_UID'] )) {

                    $oTrigger->remove( $aRow['TRI_UID'] );

                }

                $oDataset->next();

            }

            //Delete the routes of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( RoutePeer::PRO_UID, $sProUid );

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

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

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oRoute->routeExists( $aRow['ROU_UID'] )) {

                    $oRoute->remove( $aRow['ROU_UID'] );

                }

                $oDataset->next();

            }

            //Delete the swimlanes elements of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( SwimlanesElementsPeer::PRO_UID, $sProUid );

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

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

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oSwimlaneElement->swimlanesElementsExists( $aRow['SWI_UID'] )) {

                    $oSwimlaneElement->remove( $aRow['SWI_UID'] );

                }

                $oDataset->next();

            }



            //Delete the DB connections of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( DbSourcePeer::PRO_UID, $sProUid );

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

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

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oConnection->Exists( $aRow['DBS_UID'], $aRow['PRO_UID'] )) {

                    $oConnection->remove( $aRow['DBS_UID'], $aRow['PRO_UID'] );

                }

                $oDataset->next();

            }



            //Delete the sub process of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( SubProcessPeer::PRO_PARENT, $sProUid );

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

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

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oSubProcess->subProcessExists( $aRow['SP_UID'] )) {

                    $oSubProcess->remove( $aRow['SP_UID'] );

                }

                $oDataset->next();

            }



            //Delete the caseTracker of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( CaseTrackerPeer::PRO_UID, $sProUid );

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

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

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oCaseTracker->caseTrackerExists( $aRow['PRO_UID'] )) {

                    $oCaseTracker->remove( $aRow['PRO_UID'] );

                }

                $oDataset->next();

            }



            //Delete the caseTrackerObject of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( CaseTrackerObjectPeer::PRO_UID, $sProUid );

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

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

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oCaseTrackerObject->caseTrackerObjectExists( $aRow['CTO_UID'] )) {

                    $oCaseTrackerObject->remove( $aRow['CTO_UID'] );

                }

                $oDataset->next();

            }



            //Delete the ObjectPermission of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( ObjectPermissionPeer::PRO_UID, $sProUid );

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

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

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oObjectPermission->Exists( $aRow['OP_UID'] )) {

                    $oObjectPermission->remove( $aRow['OP_UID'] );

                }

                $oDataset->next();

            }



            //Delete the Stage of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( StagePeer::PRO_UID, $sProUid );

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

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

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oStage->Exists( $aRow['STG_UID'] )) {

                    $oStage->remove( $aRow['STG_UID'] );

                }

                $oDataset->next();

            }



            //Delete the Event of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( EventPeer::PRO_UID, $sProUid );

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

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

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oEvent->Exists( $aRow['EVN_UID'] )) {

                    $oEvent->remove( $aRow['EVN_UID'] );

                }

                $oDataset->next();

                if ($oEvent->existsByTaskUidFrom( $aRow['TAS_UID'] )) {

                    $aRowEvent = $oEvent->getRowByTaskUidFrom( $aRow['TAS_UID'] );

                    $oEvent->remove( $aRowEvent['EVN_UID'] );

                }

                $oDataset->next();

            }



            //Delete the CaseScheduler of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( CaseSchedulerPeer::PRO_UID, $sProUid );

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

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

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oCaseScheduler->Exists( $aRow['SCH_UID'] )) {

                    $oCaseScheduler->remove( $aRow['SCH_UID'] );

                }

                $oDataset->next();

            }



            //Delete the TaskExtraProperties of the process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->addSelectColumn( ConfigurationPeer::CFG_UID );

            $oCriteria->addSelectColumn( ConfigurationPeer::OBJ_UID );

            $oCriteria->addSelectColumn( ConfigurationPeer::CFG_VALUE );

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

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

            $oCriteria->addSelectColumn( ConfigurationPeer::APP_UID );

            $oCriteria->add( TaskPeer::PRO_UID, $sProUid );

            $oCriteria->add( ConfigurationPeer::CFG_UID, 'TAS_EXTRA_PROPERTIES' );

            $oCriteria->addJoin( ConfigurationPeer::OBJ_UID, TaskPeer::TAS_UID );

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

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

            $oDataset->next();

            while ($aRow = $oDataset->getRow()) {

                if ($oConfig->exists($aRow['CFG_UID'], $aRow['OBJ_UID'], $aRow['PRO_UID'], $aRow['USR_UID'], $aRow['APP_UID'])) {

                    $oConfig->remove( $aRow['CFG_UID'], $aRow['OBJ_UID'], $aRow['PRO_UID'], $aRow['USR_UID'], $aRow['APP_UID'] );

                }

                $oDataset->next();

            }



            return true;

        } catch (Exception $oError) {

            throw ($oError);

        }

    }
Esempio n. 9
0
 /**
  * Get related steps for a determinated case
  *
  * @author Erik A. O. <*****@*****.**>
  */
 function getAllCaseSteps($PRO_UID, $TAS_UID, $APP_UID)
 {
     $c = new Criteria();
     $c->addSelectColumn('*');
     $c->add(StepPeer::PRO_UID, $PRO_UID);
     $c->add(StepPeer::TAS_UID, $TAS_UID);
     $c->addAscendingOrderByColumn(StepPeer::STEP_POSITION);
     return StepPeer::doSelect($c);
 }
Esempio n. 10
0
 /**
  * Implementation for 'DELETE' method for Rest API
  *
  * @param  mixed $stepUid 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 delete($stepUid)
 {
     $conn = Propel::getConnection(StepPeer::DATABASE_NAME);
     try {
         $conn->begin();
         $obj = StepPeer::retrieveByPK($stepUid);
         if (!is_object($obj)) {
             throw new RestException(412, 'Record does not exist.');
         }
         $obj->delete();
         $conn->commit();
     } catch (Exception $e) {
         $conn->rollback();
         throw new RestException(412, $e->getMessage());
     }
 }
Esempio n. 11
0
 /**
  * Update WebEntry-Event
  *
  * @param string $webEntryEventUid Unique id of WebEntry-Event
  * @param string $userUidUpdater   Unique id of updater User
  * @param array  $arrayData        Data
  *
  * return array Return data of the WebEntry-Event updated
  */
 public function update($webEntryEventUid, $userUidUpdater, array $arrayData)
 {
     try {
         //Verify data
         $process = new \ProcessMaker\BusinessModel\Process();
         $validator = new \ProcessMaker\BusinessModel\Validator();
         $validator->throwExceptionIfDataIsNotArray($arrayData, "\$arrayData");
         $validator->throwExceptionIfDataIsEmpty($arrayData, "\$arrayData");
         //Set data
         $arrayData = array_change_key_case($arrayData, CASE_UPPER);
         $arrayDataBackup = $arrayData;
         unset($arrayData["WEE_UID"]);
         unset($arrayData["PRJ_UID"]);
         unset($arrayData["WEE_WE_UID"]);
         unset($arrayData["WEE_WE_TAS_UID"]);
         //Set variables
         $arrayWebEntryEventData = $this->getWebEntryEvent($webEntryEventUid, true);
         $arrayFinalData = array_merge($arrayWebEntryEventData, $arrayData);
         //Verify data
         $this->throwExceptionIfNotExistsWebEntryEvent($webEntryEventUid, $this->arrayFieldNameForException["webEntryEventUid"]);
         $this->throwExceptionIfDataIsInvalid($webEntryEventUid, $arrayWebEntryEventData["PRJ_UID"], $arrayData);
         //Update
         $cnn = \Propel::getConnection("workflow");
         $this->webEntryEventWebEntryUid = "";
         $this->webEntryEventWebEntryTaskUid = "";
         try {
             //WebEntry
             $option = "UPDATE";
             if (isset($arrayData["WEE_STATUS"])) {
                 if ($arrayData["WEE_STATUS"] == "ENABLED") {
                     if ($arrayWebEntryEventData["WEE_STATUS"] == "DISABLED") {
                         $option = "INSERT";
                     }
                 } else {
                     if ($arrayWebEntryEventData["WEE_STATUS"] == "ENABLED") {
                         $option = "DELETE";
                     }
                 }
             }
             switch ($option) {
                 case "INSERT":
                     $this->createWebEntry($arrayFinalData["PRJ_UID"], $arrayFinalData["EVN_UID"], $arrayFinalData["ACT_UID"], $arrayFinalData["DYN_UID"], $arrayFinalData["USR_UID"], $arrayFinalData["WEE_TITLE"], $arrayFinalData["WEE_DESCRIPTION"], $userUidUpdater);
                     $arrayData["WEE_WE_UID"] = $this->webEntryEventWebEntryUid;
                     $arrayData["WEE_WE_TAS_UID"] = $this->webEntryEventWebEntryTaskUid;
                     break;
                 case "UPDATE":
                     if ($arrayWebEntryEventData["WEE_WE_UID"] != "") {
                         $task = new \Tasks();
                         //Task - Step
                         if (isset($arrayData["DYN_UID"]) && $arrayData["DYN_UID"] != $arrayWebEntryEventData["DYN_UID"]) {
                             //Delete
                             $step = new \Step();
                             $criteria = new \Criteria("workflow");
                             $criteria->add(\StepPeer::TAS_UID, $arrayWebEntryEventData["WEE_WE_TAS_UID"]);
                             $rsCriteria = \StepPeer::doSelectRS($criteria);
                             $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
                             while ($rsCriteria->next()) {
                                 $row = $rsCriteria->getRow();
                                 $result = $step->remove($row["STEP_UID"]);
                             }
                             //Add
                             $step = new \Step();
                             $stepUid = $step->create(array("PRO_UID" => $arrayWebEntryEventData["PRJ_UID"], "TAS_UID" => $arrayWebEntryEventData["WEE_WE_TAS_UID"]));
                             $result = $step->update(array("STEP_UID" => $stepUid, "STEP_TYPE_OBJ" => "DYNAFORM", "STEP_UID_OBJ" => $arrayData["DYN_UID"], "STEP_POSITION" => 1, "STEP_MODE" => "EDIT"));
                         }
                         //Task - User
                         if (isset($arrayData["USR_UID"]) && $arrayData["USR_UID"] != $arrayWebEntryEventData["USR_UID"]) {
                             //Unassign
                             $taskUser = new \TaskUser();
                             $criteria = new \Criteria("workflow");
                             $criteria->add(\TaskUserPeer::TAS_UID, $arrayWebEntryEventData["WEE_WE_TAS_UID"]);
                             $rsCriteria = \TaskUserPeer::doSelectRS($criteria);
                             $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
                             while ($rsCriteria->next()) {
                                 $row = $rsCriteria->getRow();
                                 $result = $taskUser->remove($row["TAS_UID"], $row["USR_UID"], $row["TU_TYPE"], $row["TU_RELATION"]);
                             }
                             //Assign
                             $result = $task->assignUser($arrayWebEntryEventData["WEE_WE_TAS_UID"], $arrayData["USR_UID"], 1);
                         }
                         //Route
                         if (isset($arrayData["ACT_UID"]) && $arrayData["ACT_UID"] != $arrayWebEntryEventData["ACT_UID"]) {
                             //Delete
                             $result = $task->deleteAllRoutesOfTask($arrayWebEntryEventData["PRJ_UID"], $arrayWebEntryEventData["WEE_WE_TAS_UID"], true);
                             //Add
                             $workflow = \ProcessMaker\Project\Workflow::load($arrayWebEntryEventData["PRJ_UID"]);
                             $result = $workflow->addRoute($arrayWebEntryEventData["WEE_WE_TAS_UID"], $arrayData["ACT_UID"], "SEQUENTIAL");
                         }
                         //WebEntry
                         $arrayDataAux = array();
                         if (isset($arrayData["DYN_UID"])) {
                             $arrayDataAux["DYN_UID"] = $arrayData["DYN_UID"];
                         }
                         if (isset($arrayData["USR_UID"])) {
                             $arrayDataAux["USR_UID"] = $arrayData["USR_UID"];
                         }
                         if (isset($arrayData["WEE_TITLE"])) {
                             $arrayDataAux["WE_TITLE"] = $arrayData["WEE_TITLE"];
                         }
                         if (isset($arrayData["WEE_DESCRIPTION"])) {
                             $arrayDataAux["WE_DESCRIPTION"] = $arrayData["WEE_DESCRIPTION"];
                         }
                         if (count($arrayDataAux) > 0) {
                             $arrayDataAux = $this->webEntry->update($arrayWebEntryEventData["WEE_WE_UID"], $userUidUpdater, $arrayDataAux);
                         }
                     }
                     break;
                 case "DELETE":
                     $this->deleteWebEntry($arrayWebEntryEventData["WEE_WE_UID"], $arrayWebEntryEventData["WEE_WE_TAS_UID"]);
                     $arrayData["WEE_WE_UID"] = "";
                     $arrayData["WEE_WE_TAS_UID"] = "";
                     break;
             }
             //WebEntry-Event
             $webEntryEvent = \WebEntryEventPeer::retrieveByPK($webEntryEventUid);
             $webEntryEvent->fromArray($arrayData, \BasePeer::TYPE_FIELDNAME);
             if ($webEntryEvent->validate()) {
                 $cnn->begin();
                 $result = $webEntryEvent->save();
                 $cnn->commit();
                 //Set WEE_TITLE
                 if (isset($arrayData["WEE_TITLE"])) {
                     $result = \Content::addContent("WEE_TITLE", "", $webEntryEventUid, SYS_LANG, $arrayData["WEE_TITLE"]);
                 }
                 //Set WEE_DESCRIPTION
                 if (isset($arrayData["WEE_DESCRIPTION"])) {
                     $result = \Content::addContent("WEE_DESCRIPTION", "", $webEntryEventUid, SYS_LANG, $arrayData["WEE_DESCRIPTION"]);
                 }
                 //Return
                 $arrayData = $arrayDataBackup;
                 if (!$this->formatFieldNameInUppercase) {
                     $arrayData = array_change_key_case($arrayData, CASE_LOWER);
                 }
                 return $arrayData;
             } else {
                 $msg = "";
                 foreach ($webEntryEvent->getValidationFailures() as $validationFailure) {
                     $msg = $msg . ($msg != "" ? "\n" : "") . $validationFailure->getMessage();
                 }
                 throw new \Exception(\G::LoadTranslation("ID_REGISTRY_CANNOT_BE_UPDATED") . ($msg != "" ? "\n" . $msg : ""));
             }
         } catch (\Exception $e) {
             $cnn->rollback();
             $this->deleteWebEntry($this->webEntryEventWebEntryUid, $this->webEntryEventWebEntryTaskUid);
             throw $e;
         }
     } catch (\Exception $e) {
         throw $e;
     }
 }
Esempio n. 12
0
$c = new Criteria();
$c->add(StepPeer::PRO_UID, $_SESSION['PROCESS']);
$c->add(StepPeer::TAS_UID, $_SESSION['TASK']);
$c->addAscendingOrderByColumn(StepPeer::STEP_POSITION);
// classes
G::LoadClass('tree');
G::LoadClass('pmScript');
G::LoadClass('case');
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$externalSteps = $oPluginRegistry->getSteps();
$oTree = new Tree();
$oTree->nodeType = "blank";
$oTree->name = 'Steps';
$oTree->showSign = false;
$tasUid = $_SESSION['TASK'];
$rs = StepPeer::doSelect($c);
$oCase = new Cases();
$Fields = $oCase->loadCase($_SESSION['APPLICATION']);
$oPMScript = new PMScript();
$oPMScript->setFields($Fields['APP_DATA']);
foreach ($rs as $key => $aRow) {
    $bAccessStep = false;
    if (trim($aRow->getStepCondition()) != '') {
        $oPMScript->setScript($aRow->getStepCondition());
        $bAccessStep = $oPMScript->evaluate();
    } else {
        $bAccessStep = true;
    }
    if ($bAccessStep) {
        switch ($aRow->getStepTypeObj()) {
            case 'DYNAFORM':
while ($resultDynaForm->next()) {
    $row = $resultDynaForm->getRow();
    $arrayDynaFormUid[$row["STEP_UID_OBJ"]] = $row["STEP_UID_OBJ"];
}
$resultInput = $cases->getAllInputsStepsToRevise($aFields["APP_UID"]);
while ($resultInput->next()) {
    $row = $resultInput->getRow();
    $arrayInputUid[$row["STEP_UID_OBJ"]] = $row["STEP_UID_OBJ"];
}
$criteria = new Criteria();
$criteria->addSelectColumn(StepPeer::STEP_TYPE_OBJ);
$criteria->addSelectColumn(StepPeer::STEP_UID_OBJ);
$criteria->add(StepPeer::PRO_UID, $aFields["PRO_UID"], Criteria::EQUAL);
$criteria->add(StepPeer::TAS_UID, $aFields["APP_DATA"]["TASK"], Criteria::EQUAL);
$criteria->addAscendingOrderByColumn(StepPeer::STEP_POSITION);
$rsCriteria = StepPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$url = "";
$flag = false;
while ($rsCriteria->next()) {
    $row = $rsCriteria->getRow();
    $stepTypeObj = $row["STEP_TYPE_OBJ"];
    $stepUidObj = $row["STEP_UID_OBJ"];
    switch ($stepTypeObj) {
        case "DYNAFORM":
            if (isset($arrayDynaFormUid[$stepUidObj])) {
                $url = "cases_StepToRevise?type=DYNAFORM&PRO_UID=" . $aFields["PRO_UID"] . "&DYN_UID=" . $stepUidObj . "&APP_UID=" . $sAppUid . "&DEL_INDEX=" . $iDelIndex . "&position=1";
                $flag = true;
            }
            break;
        case "INPUT_DOCUMENT":
Esempio n. 14
0
 /**
  * Verify if not exists input Document in Steps
  *
  * @param string $applicationUid Unique id of Case
  * @param string $delIndex       Delegataion index
  * @param string $appDocumentUid
  *
  * return void Throw exception if not exists input Document in Steps
  */
 public function throwExceptionIfInputDocumentNotExistsInSteps($applicacionUid, $delIndex, $appDocumentUid)
 {
     try {
         //Verify Case
         $appDelegation = \AppDelegationPeer::retrieveByPK($applicacionUid, $delIndex);
         if (is_null($appDelegation)) {
             throw new \Exception(\G::LoadTranslation("ID_CASE_DEL_INDEX_DOES_NOT_EXIST", array("app_uid", $applicacionUid, "del_index", $delIndex)));
         }
         $taskUid = $appDelegation->getTasUid();
         //Verify Steps
         $criteria = new \Criteria("workflow");
         $criteria->addSelectColumn(\AppDocumentPeer::DOC_UID);
         $criteria->add(\AppDocumentPeer::APP_DOC_UID, $appDocumentUid, \Criteria::EQUAL);
         $criteria->add(\AppDocumentPeer::APP_UID, $applicacionUid, \Criteria::EQUAL);
         $criteria->add(\AppDocumentPeer::APP_DOC_TYPE, "INPUT", \Criteria::EQUAL);
         $rsCriteria = \AppDocumentPeer::doSelectRS($criteria);
         $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         if ($rsCriteria->next()) {
             $row = $rsCriteria->getRow();
             $inputDocumentUid = $row["DOC_UID"];
             $criteria = new \Criteria("workflow");
             $criteria->addSelectColumn(\StepPeer::STEP_UID);
             $criteria->add(\StepPeer::TAS_UID, $taskUid, \Criteria::EQUAL);
             $criteria->add(\StepPeer::STEP_TYPE_OBJ, "INPUT_DOCUMENT", \Criteria::EQUAL);
             $criteria->add(\StepPeer::STEP_UID_OBJ, $inputDocumentUid, \Criteria::EQUAL);
             $rsCriteria = \StepPeer::doSelectRS($criteria);
             $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
             if (!$rsCriteria->next()) {
                 throw new \Exception(\G::LoadTranslation("ID_CASES_INPUT_DOCUMENT_DOES_NOT_EXIST", array($appDocumentUid)));
             }
         }
     } catch (\Exception $e) {
         throw $e;
     }
 }
Esempio n. 15
0
 /**
  * Get the assigned steps of a task
  * @param string $sTaskUID
  * @return array
  */
 public function getStepsOfTask($sTaskUID)
 {
     try {
         $aSteps = array();
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(StepPeer::TAS_UID, $sTaskUID);
         $oCriteria->addAscendingOrderByColumn(StepPeer::STEP_POSITION);
         $oDataset = StepPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $aSteps[] = $aRow;
             $oDataset->next();
         }
         return $aSteps;
     } catch (Exception $oError) {
         throw $oError;
     }
 }
Esempio n. 16
0
    public function loadTriggers($sTasUid, $sStepType, $sStepUidObj, $sTriggerType)

    {

        $aTriggers = array();

        if (($sStepUidObj != -1) && ($sStepUidObj != -2)) {

            $c = new Criteria();

            $c->clearSelectColumns();

            $c->addSelectColumn(StepPeer::STEP_UID);

            $c->add(StepPeer::TAS_UID, $sTasUid);

            $c->add(StepPeer::STEP_TYPE_OBJ, $sStepType);

            $c->add(StepPeer::STEP_UID_OBJ, $sStepUidObj);

            $rs = StepPeer::doSelectRS($c);

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

            $rs->next();

            $row = $rs->getRow();

            $sStepUid = $row['STEP_UID'];

        } else {

            $sStepUid = $sStepUidObj;

        }



        $delimiter = DBAdapter::getStringDelimiter();



        $c = new Criteria();

        $c->clearSelectColumns();

        $c->addSelectColumn(TriggersPeer::TRI_UID);

        $c->addAsColumn("TRI_TITLE", ContentPeer::CON_VALUE);

        $c->addSelectColumn(StepTriggerPeer::ST_CONDITION);

        $c->addSelectColumn(TriggersPeer::TRI_TYPE);

        $c->addSelectColumn(TriggersPeer::TRI_WEBBOT);



        $arrayCondition = array();

        $arrayCondition[] = array(TriggersPeer::TRI_UID, ContentPeer::CON_ID, Criteria::EQUAL);

        $arrayCondition[] = array(ContentPeer::CON_CATEGORY, $delimiter . "TRI_TITLE" . $delimiter, Criteria::EQUAL);

        $arrayCondition[] = array(ContentPeer::CON_LANG, $delimiter . SYS_LANG . $delimiter, Criteria::EQUAL);

        $c->addJoinMC($arrayCondition, Criteria::LEFT_JOIN);



        $c->add(StepTriggerPeer::STEP_UID, $sStepUid);

        $c->add(StepTriggerPeer::TAS_UID, $sTasUid);

        $c->add(StepTriggerPeer::ST_TYPE, $sTriggerType);

        $c->addJoin(StepTriggerPeer::TRI_UID, TriggersPeer::TRI_UID, Criteria::LEFT_JOIN);

        $c->addAscendingOrderByColumn(StepTriggerPeer::ST_POSITION);

        $rs = TriggersPeer::doSelectRS($c);

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



        while ($rs->next()) {

            $row = $rs->getRow();



            $aTriggers[] = $row;

        }



        return $aTriggers;

    }
Esempio n. 17
0
    /**
     * Delete Steps and triggers of a Task
     *
     * @param string $stepUid Unique id of Step
     * @param string $taskUid Unique id of Step
     *
     * return void
     */
    public function deleteAll($taskUid)
    {
        try {
            $step = new \Step();
            $stepTrigger = new \ProcessMaker\BusinessModel\Step\Trigger();

            $criteriaTrigger = new \Criteria("workflow");
            $criteriaTrigger->addSelectColumn(\StepTriggerPeer::STEP_UID);
            $criteriaTrigger->addSelectColumn(\StepTriggerPeer::ST_TYPE);
            $criteriaTrigger->addSelectColumn(\StepTriggerPeer::TRI_UID);
            $criteriaTrigger->add(\StepTriggerPeer::TAS_UID, $taskUid, \Criteria::EQUAL);
            $rsCriteriaTrigger = \StepTriggerPeer::doSelectRS($criteriaTrigger);
            $rsCriteriaTrigger->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
            $rsCriteriaTrigger->next();

            while ($aRowTrigger = $rsCriteriaTrigger->getRow()) {

                $stepTrigger->delete($aRowTrigger['STEP_UID'], $aRowTrigger['ST_TYPE'], $taskUid, $aRowTrigger['TRI_UID']);
                $rsCriteriaTrigger->next();
            }

            $criteria = new \Criteria("workflow");
            $criteria->addSelectColumn(\StepPeer::STEP_UID);
            $criteria->add(\StepPeer::TAS_UID, $taskUid, \Criteria::EQUAL);
            $rsCriteria = \StepPeer::doSelectRS($criteria);
            $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
            $rsCriteria->next();

            while ($aRow = $rsCriteria->getRow()) {
                $step->remove($aRow['STEP_UID']);
                $rsCriteria->next();
            }

        } catch (\Exception $e) {
            throw $e;
        }
    }
Esempio n. 18
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(StepPeer::STEP_UID, $pks, Criteria::IN);
         $objs = StepPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Esempio n. 19
0
        break;
}
*/
/*$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'processes';
$G_ID_MENU_SELECTED = 'PROCESSES';
$G_ID_SUB_MENU_SELECTED = 'DB_CONNECTIONS';
*/
$G_PUBLISH = new Publisher();
G::LoadClass('processMap');
$oProcess = new processMap();
$oCriteria = $oProcess->getConditionProcessList();
if (ProcessPeer::doCount($oCriteria) > 0) {
    $aProcesses = array();
    $aProcesses[] = array('PRO_UID' => 'char', 'PRO_TITLE' => 'char');
    $oDataset = StepPeer::doSelectRS($oCriteria);
    $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
    $oDataset->next();
    $sProcessUID = '';
    while ($aRow = $oDataset->getRow()) {
        if ($sProcessUID == '') {
            $sProcessUID = $aRow['PRO_UID'];
        }
        $aProcesses[] = array('PRO_UID' => $aRow['PRO_UID'], 'PRO_TITLE' => $aRow['PRO_TITLE']);
        $oDataset->next();
    }
    global $_DBArray;
    $_DBArray['PROCESSES'] = $aProcesses;
    $_SESSION['_DBArray'] = $_DBArray;
    $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dbConnections/dbConnections_Events');
    require_once 'classes/model/DbSource.php';
Esempio n. 20
0
 /**
  * Get all Steps of a Task
  *
  * @param string $taskUid Unique id of Task
  *
  * return array Return an array with all Steps of a Task
  */
 public function getSteps($taskUid)
 {
     try {
         $arrayStep = array();
         $step = new \ProcessMaker\BusinessModel\Step();
         $step->setFormatFieldNameInUppercase($this->formatFieldNameInUppercase);
         $step->setArrayParamException($this->arrayParamException);
         //Verify data
         $this->throwExceptionIfNotExistsTask("", $taskUid, $this->arrayParamException["taskUid"]);
         //Get data
         $criteria = new \Criteria("workflow");
         $criteria->add(\StepPeer::TAS_UID, $taskUid, \Criteria::EQUAL);
         $criteria->addAscendingOrderByColumn(\StepPeer::STEP_POSITION);
         $rsCriteria = \StepPeer::doSelectRS($criteria);
         $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         while ($rsCriteria->next()) {
             $row = $rsCriteria->getRow();
             $arrayData = $step->getStep($row["STEP_UID"]);
             if (count($arrayData) > 0) {
                 $arrayStep[] = $arrayData;
             }
         }
         //Return
         return $arrayStep;
     } catch (\Exception $e) {
         throw $e;
     }
 }
Esempio n. 21
0
 /**
  * Implementation for 'DELETE' method for Rest API
  *
  * @param  mixed $stepUid 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 delete($stepUid)
 {
     $conn = Propel::getConnection(StepPeer::DATABASE_NAME);
     try {
         $conn->begin();
         $obj = StepPeer::retrieveByPK($stepUid);
         if (!is_object($obj)) {
             throw new RestException(412, G::LoadTranslation('ID_RECORD_DOES_NOT_EXIST'));
         }
         $obj->delete();
         $conn->commit();
     } catch (Exception $e) {
         $conn->rollback();
         throw new RestException(412, $e->getMessage());
     }
 }