/**
  * verify if a dynaform is assigned some steps
  *
  * @param string $proUid the uid of the process
  * @param string $dynUid the uid of the dynaform
  *
  * @return array
  */
 public function verifyDynaformAssigCaseTracker($dynUid, $proUid)
 {
     $res = array();
     $oCriteria = new Criteria();
     $oCriteria->addSelectColumn(CaseTrackerObjectPeer::CTO_UID);
     $oCriteria->add(CaseTrackerObjectPeer::PRO_UID, $proUid);
     $oCriteria->add(CaseTrackerObjectPeer::CTO_UID_OBJ, $dynUid);
     $oCriteria->add(CaseTrackerObjectPeer::CTO_TYPE_OBJ, 'DYNAFORM');
     $oDataset = CaseTrackerObjectPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     while ($oDataset->next()) {
         $res[] = $oDataset->getRow();
     }
     return $res;
 }
Esempio n. 2
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);

        }

    }
 /**
  * getAvailableCaseTrackerObjectsCriteria
  *
  * @param string $sProcessUID Default value empty
  * @return object(Criteria) $oCriteria
  */
 public function getAvailableExtCaseTrackerObjects($sProcessUID = '')
 {
     $oCriteria = $this->getCaseTrackerObjectsCriteria($sProcessUID);
     $oDataset = CaseTrackerObjectPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $oDataset->next();
     $aDynaformsUIDS = array();
     $aInputsUIDS = array();
     $aOutputsUIDS = array();
     while ($aRow = $oDataset->getRow()) {
         switch ($aRow['CTO_TYPE_OBJ']) {
             case 'DYNAFORM':
                 $aDynaformsUIDS[] = $aRow['CTO_UID_OBJ'];
                 break;
             case 'INPUT_DOCUMENT':
                 $aInputsUIDS[] = $aRow['CTO_UID_OBJ'];
                 break;
             case 'OUTPUT_DOCUMENT':
                 $aOutputsUIDS[] = $aRow['CTO_UID_OBJ'];
                 break;
         }
         $oDataset->next();
     }
     $aAvailableObjects = array();
     $aAvailableObjects[] = array('OBJECT_UID' => 'char', 'OBJECT_TYPE' => 'char', 'OBJECT_TITLE' => 'char');
     $sDelimiter = DBAdapter::getStringDelimiter();
     $oCriteria = new Criteria('workflow');
     $oCriteria->addSelectColumn(DynaformPeer::DYN_UID);
     $oCriteria->addAsColumn('DYN_TITLE', 'C.CON_VALUE');
     $oCriteria->addAlias('C', 'CONTENT');
     $aConditions = array();
     $aConditions[] = array(DynaformPeer::DYN_UID, 'C.CON_ID');
     $aConditions[] = array('C.CON_CATEGORY', $sDelimiter . 'DYN_TITLE' . $sDelimiter);
     $aConditions[] = array('C.CON_LANG', $sDelimiter . SYS_LANG . $sDelimiter);
     $oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
     $oCriteria->add(DynaformPeer::PRO_UID, $sProcessUID);
     $oCriteria->add(DynaformPeer::DYN_TYPE, 'xmlform');
     $oCriteria->add(DynaformPeer::DYN_UID, $aDynaformsUIDS, Criteria::NOT_IN);
     $oDataset = DynaformPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $oDataset->next();
     while ($aRow = $oDataset->getRow()) {
         $aAvailableObjects[] = array('OBJECT_UID' => $aRow['DYN_UID'], 'OBJECT_TYPE' => 'DYNAFORM', 'OBJECT_TITLE' => $aRow['DYN_TITLE']);
         $oDataset->next();
     }
     $oCriteria = new Criteria('workflow');
     $oCriteria->addSelectColumn(InputDocumentPeer::INP_DOC_UID);
     $oCriteria->addAsColumn('INP_DOC_TITLE', 'C.CON_VALUE');
     $oCriteria->addAlias('C', 'CONTENT');
     $aConditions = array();
     $aConditions[] = array(InputDocumentPeer::INP_DOC_UID, 'C.CON_ID');
     $aConditions[] = array('C.CON_CATEGORY', $sDelimiter . 'INP_DOC_TITLE' . $sDelimiter);
     $aConditions[] = array('C.CON_LANG', $sDelimiter . SYS_LANG . $sDelimiter);
     $oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
     $oCriteria->add(InputDocumentPeer::PRO_UID, $sProcessUID);
     $oCriteria->add(InputDocumentPeer::INP_DOC_UID, $aInputsUIDS, Criteria::NOT_IN);
     $oDataset = InputDocumentPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $oDataset->next();
     while ($aRow = $oDataset->getRow()) {
         $aAvailableObjects[] = array('OBJECT_UID' => $aRow['INP_DOC_UID'], 'OBJECT_TYPE' => 'INPUT_DOCUMENT', 'OBJECT_TITLE' => $aRow['INP_DOC_TITLE']);
         $oDataset->next();
     }
     $oCriteria = new Criteria('workflow');
     $oCriteria->addSelectColumn(OutputDocumentPeer::OUT_DOC_UID);
     $oCriteria->addAsColumn('OUT_DOC_TITLE', 'C.CON_VALUE');
     $oCriteria->addAlias('C', 'CONTENT');
     $aConditions = array();
     $aConditions[] = array(OutputDocumentPeer::OUT_DOC_UID, 'C.CON_ID');
     $aConditions[] = array('C.CON_CATEGORY', $sDelimiter . 'OUT_DOC_TITLE' . $sDelimiter);
     $aConditions[] = array('C.CON_LANG', $sDelimiter . SYS_LANG . $sDelimiter);
     $oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
     $oCriteria->add(OutputDocumentPeer::PRO_UID, $sProcessUID);
     $oCriteria->add(OutputDocumentPeer::OUT_DOC_UID, $aOutputsUIDS, Criteria::NOT_IN);
     $oDataset = OutputDocumentPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $oDataset->next();
     while ($aRow = $oDataset->getRow()) {
         $aAvailableObjects[] = array('OBJECT_UID' => $aRow['OUT_DOC_UID'], 'OBJECT_TYPE' => 'OUTPUT_DOCUMENT', 'OBJECT_TITLE' => $aRow['OUT_DOC_TITLE']);
         $oDataset->next();
     }
     return $aAvailableObjects;
     /*global $_DBArray;
       $_DBArray = (isset($_SESSION ['_DBArray']) ? $_SESSION ['_DBArray'] : '');
       $_DBArray ['availableObjects'] = $aAvailableObjects;
       $_SESSION ['_DBArray'] = $_DBArray;
       G::LoadClass('ArrayPeer');
       $oCriteria = new Criteria('dbarray');
       $oCriteria->setDBArrayTable('availableObjects');
       return $oCriteria;*/
 }
Esempio n. 4
0
 /**
  * Get all Case Tracker Objects of a Process
  *
  * @param string $processUid Unique id of Process
  *
  * return array Return an array with all Case Tracker Objects of a Process
  */
 public function getCaseTrackerObjects($processUid)
 {
     try {
         $arrayCaseTrackerObject = array();
         //Verify data
         $process = new \ProcessMaker\BusinessModel\Process();
         $process->throwExceptionIfNotExistsProcess($processUid, "prj_uid");
         $dynaform = new \Dynaform();
         $inputDocument = new \InputDocument();
         $outputDocument = new \OutputDocument();
         $arrayCaseTrackerObject = array();
         $criteria = new \Criteria("workflow");
         $criteria->add(\CaseTrackerObjectPeer::PRO_UID, $processUid, \Criteria::EQUAL);
         $rsCriteria = \CaseTrackerObjectPeer::doSelectRS($criteria);
         $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         while ($rsCriteria->next()) {
             $row = $rsCriteria->getRow();
             $titleObj = "";
             $descriptionObj = "";
             switch ($row["CTO_TYPE_OBJ"]) {
                 case "DYNAFORM":
                     $arrayData = $dynaform->load($row["CTO_UID_OBJ"]);
                     $titleObj = $arrayData["DYN_TITLE"];
                     $descriptionObj = $arrayData["DYN_DESCRIPTION"];
                     break;
                 case "INPUT_DOCUMENT":
                     $arrayData = $inputDocument->getByUid($row["CTO_UID_OBJ"]);
                     $titleObj = $arrayData["INP_DOC_TITLE"];
                     $descriptionObj = $arrayData["INP_DOC_DESCRIPTION"];
                     break;
                 case "OUTPUT_DOCUMENT":
                     $arrayData = $outputDocument->getByUid($row["CTO_UID_OBJ"]);
                     $titleObj = $arrayData["OUT_DOC_TITLE"];
                     $descriptionObj = $arrayData["OUT_DOC_DESCRIPTION"];
                     break;
             }
             $arrayCaseTrackerObject[] = array("cto_uid" => $row["CTO_UID"], "cto_type_obj" => $row["CTO_TYPE_OBJ"], "cto_uid_obj" => $row["CTO_UID_OBJ"], "cto_condition" => $row["CTO_CONDITION"], "cto_position" => (int) $row["CTO_POSITION"], "obj_title" => $titleObj, "obj_description" => $descriptionObj);
         }
         $arrayCaseTrackerObject = \ProcessMaker\Util\ArrayUtil::sort($arrayCaseTrackerObject, array("cto_position"), SORT_ASC);
         return $arrayCaseTrackerObject;
     } catch (\Exception $e) {
         throw $e;
     }
 }
 /**
  * Method to do selects.
  *
  * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
  * @param      Connection $con
  * @return     array Array of selected Objects
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelect(Criteria $criteria, $con = null)
 {
     return CaseTrackerObjectPeer::populateObjects(CaseTrackerObjectPeer::doSelectRS($criteria, $con));
 }
Esempio n. 6
0
 function reorderPositions($sProcessUID, $iPosition)
 {
     try {
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(CaseTrackerObjectPeer::PRO_UID, $sProcessUID);
         $oCriteria->add(CaseTrackerObjectPeer::CTO_POSITION, $iPosition, '>');
         $oDataset = CaseTrackerObjectPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $this->update(array('CTO_UID' => $aRow['CTO_UID'], 'PRO_UID' => $aRow['PRO_UID'], 'CTO_TYPE_OBJ' => $aRow['CTO_TYPE_OBJ'], 'CTO_UID_OBJ' => $aRow['CTO_UID_OBJ'], 'CTO_CONDITION' => $aRow['CTO_CONDITION'], 'CTO_POSITION' => $aRow['CTO_POSITION'] - 1));
             $oDataset->next();
         }
     } catch (Exception $oException) {
         throw $Exception;
     }
 }
 /**
  * Get data of a Case Tracker Object
  *
  * @param string $caseTrackerObjectUid Unique id of Case Tracker Object
  *
  * return array Return an array with data of a Case Tracker Object
  */
 public function getCaseTrackerObject($caseTrackerObjectUid)
 {
     try {
         //Verify data
         $caseTrackerObject = new \CaseTrackerObject();
         if (!$caseTrackerObject->caseTrackerObjectExists($caseTrackerObjectUid)) {
             throw new \Exception(\G::LoadTranslation("ID_CASE_TRACKER_OBJECT_DOES_NOT_EXIST", array(strtolower("CTO_UID"), $caseTrackerObjectUid)));
         }
         //Get data
         $dynaform = new \Dynaform();
         $inputDocument = new \InputDocument();
         $outputDocument = new \OutputDocument();
         $criteria = new \Criteria("workflow");
         $criteria->add(\CaseTrackerObjectPeer::CTO_UID, $caseTrackerObjectUid, \Criteria::EQUAL);
         $rsCriteria = \CaseTrackerObjectPeer::doSelectRS($criteria);
         $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         $rsCriteria->next();
         $row = $rsCriteria->getRow();
         $titleObj = "";
         $descriptionObj = "";
         switch ($row["CTO_TYPE_OBJ"]) {
             case "DYNAFORM":
                 $arrayData = $dynaform->load($row["CTO_UID_OBJ"]);
                 $titleObj = $arrayData["DYN_TITLE"];
                 $descriptionObj = $arrayData["DYN_DESCRIPTION"];
                 break;
             case "INPUT_DOCUMENT":
                 $arrayData = $inputDocument->getByUid($row["CTO_UID_OBJ"]);
                 $titleObj = $arrayData["INP_DOC_TITLE"];
                 $descriptionObj = $arrayData["INP_DOC_DESCRIPTION"];
                 break;
             case "OUTPUT_DOCUMENT":
                 $arrayData = $outputDocument->getByUid($row["CTO_UID_OBJ"]);
                 $titleObj = $arrayData["OUT_DOC_TITLE"];
                 $descriptionObj = $arrayData["OUT_DOC_DESCRIPTION"];
                 break;
         }
         return array("cto_uid" => $row["CTO_UID"], "cto_type_obj" => $row["CTO_TYPE_OBJ"], "cto_uid_obj" => $row["CTO_UID_OBJ"], "cto_condition" => $row["CTO_CONDITION"], "cto_position" => (int) $row["CTO_POSITION"], "obj_title" => $titleObj, "obj_description" => $descriptionObj);
     } catch (\Exception $e) {
         throw $e;
     }
 }