Пример #1
0
    /**

     * Create Step Trigger Rows for a Process form an array

     *

     * @param array $aStepTrigger

     * @return void

     */

    public function createStepTriggerRows ($aStepTrigger)

    {

        foreach ($aStepTrigger as $key => $row) {

            $oStepTrigger = new StepTrigger();

            //unset ($row['TAS_UID']);

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

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

            }

            $res = $oStepTrigger->createRow( $row );

        }

        return;

    }
Пример #2
0
 function remove($sStepUID)
 {
     require_once 'classes/model/StepTrigger.php';
     $oStepTriggers = new StepTrigger();
     $oCriteria = new Criteria('workflow');
     $oCriteria->add(StepTriggerPeer::STEP_UID, $sStepUID);
     $oDataset = StepTriggerPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     while ($oDataset->next()) {
         $aRow = $oDataset->getRow();
         $oStepTriggers->remove($aRow['STEP_UID'], $aRow['TAS_UID'], $aRow['TRI_UID'], $aRow['ST_TYPE']);
     }
     /*$con = Propel::getConnection(StepPeer::DATABASE_NAME);
       try
       {
         $con->begin();
         //$this->fromArray($fields,BasePeer::TYPE_FIELDNAME);
         $this->setStepUid($sStepUID);
         $result=$this->delete();
         $con->commit();
         return $result;
       }
       catch(Exception $e)
       {
         $con->rollback();
         throw($e);
       }*/
     $oConnection = Propel::getConnection(StepPeer::DATABASE_NAME);
     try {
         $oStep = StepPeer::retrieveByPK($sStepUID);
         if (!is_null($oStep)) {
             $oConnection->begin();
             $iResult = $oStep->delete();
             $oConnection->commit();
             return $iResult;
         } else {
             throw new Exception('This row doesn\'t exist!');
         }
     } catch (Exception $oError) {
         $oConnection->rollback();
         throw $oError;
     }
 }
Пример #3
0
         $oStepTrigger->update(array('STEP_UID' => $aData['STEP_UID'], 'TAS_UID' => $_SESSION['TASK'], 'TRI_UID' => $aData['TRI_UID'], 'ST_TYPE' => $aData['ST_TYPE'], 'ST_CONDITION' => $aData['ST_CONDITION']));
         break;
     case 'upTrigger':
         $aData['iPosition'] = (int) $aData['iPosition'];
         $oStepTrigger = new StepTrigger();
         $oStepTrigger->up($aData['sStep'], $_SESSION['TASK'], $aData['sTrigger'], $aData['sType'], $aData['iPosition']);
         break;
     case 'downTrigger':
         $aData['iPosition'] = (int) $aData['iPosition'];
         $oStepTrigger = new StepTrigger();
         $oStepTrigger->down($aData['sStep'], $_SESSION['TASK'], $aData['sTrigger'], $aData['sType'], $aData['iPosition']);
         break;
     case 'ofToAssignTrigger':
         $oStepTrigger = new StepTrigger();
         $oStepTrigger->reOrder($aData['sStep'], $_SESSION['TASK'], $aData['sType'], $aData['iPosition']);
         $oStepTrigger->remove($aData['sStep'], $_SESSION['TASK'], $aData['sTrigger'], $aData['sType']);
         break;
     case 'counterTriggers':
         G::LoadClass('processMap');
         $oProcessMap = new ProcessMap();
         $oCriteria1 = $oProcessMap->getStepTriggersCriteria($aData['sStep'], $_SESSION['TASK'], $aData['sType']);
         if ($aData['sType'] == 'BEFORE') {
             $oCriteria2 = $oProcessMap->getStepTriggersCriteria($aData['sStep'], $_SESSION['TASK'], 'AFTER');
         } else {
             $oCriteria2 = $oProcessMap->getStepTriggersCriteria($aData['sStep'], $_SESSION['TASK'], 'BEFORE');
         }
         $iCantity = StepTriggerPeer::doCount($oCriteria1);
         $iTotal = $iCantity + StepTriggerPeer::doCount($oCriteria2);
         echo $iTotal . '|' . $iCantity;
         break;
 }
Пример #4
0
 /**
  * Delete Trigger of a Step
  *
  * @param string $stepUid    Unique id of Step
  * @param string $type       Type (BEFORE, AFTER, BEFORE_ASSIGNMENT, BEFORE_ROUTING, AFTER_ROUTING)
  * @param string $taskUid    Unique id of Task
  * @param string $triggerUid Unique id of Trigger
  *
  * return void
  */
 public function delete($stepUid, $type, $taskUid, $triggerUid)
 {
     try {
         if ($stepUid == "") {
             switch ($type) {
                 case "BEFORE_ASSIGNMENT":
                     $stepUid = "-1";
                     $type = "BEFORE";
                     break;
                 case "BEFORE_ROUTING":
                     $stepUid = "-2";
                     $type = "BEFORE";
                     break;
                 case "AFTER_ROUTING":
                     $stepUid = "-2";
                     $type = "AFTER";
                     break;
             }
         }
         //Verify data
         if (!$this->existsRecord($stepUid, $type, $taskUid, $triggerUid)) {
             throw new \Exception(\G::LoadTranslation("ID_RECORD_DOES_NOT_EXIST_IN_TABLE", array($stepUid . ", " . $type . ", " . $taskUid . ", " . $triggerUid, "STEP_TRIGGER")));
         }
         //Get position
         $stepTrigger = new \StepTrigger();
         $arrayData = $stepTrigger->load($stepUid, $taskUid, $triggerUid, $type);
         $position = (int) $arrayData["ST_POSITION"];
         //Delete
         $stepTrigger = new \StepTrigger();
         $stepTrigger->reOrder($stepUid, $taskUid, $type, $position);
         $stepTrigger->remove($stepUid, $taskUid, $triggerUid, $type);
     } catch (\Exception $e) {
         throw $e;
     }
 }