/** * assignSupervisorStep * * @param string $sProcessUID * @param string $sObjType * @param string $sObjUID * @return void */ public function assignSupervisorStep($sProcessUID, $sObjType, $sObjUID) { $oStepSupervisor = new StepSupervisor(); $oStepSupervisor->create(array('PRO_UID' => $sProcessUID, 'STEP_TYPE_OBJ' => $sObjType, 'STEP_UID_OBJ' => $sObjUID, 'STEP_POSITION' => $oStepSupervisor->getNextPosition($sProcessUID, $sObjType))); }
/** * Assign a inputdocument supervisor of a process * * @param string $sProcessUID * @param string $sInputDocumentUID * @param int $sPuiPosition * @access public */ public function addProcessSupervisorInputDocument($sProcessUID, $sInputDocumentUID, $sPuiPosition) { $oTypeInputDocument= \InputDocumentPeer::retrieveByPK($sInputDocumentUID); if (is_null( $oTypeInputDocument )) { throw new \Exception(\G::LoadTranslation("ID_DOES NOT_INPUT_DOCUMENT", array($sInputDocumentUID))); } $aResp = array(); $sPuUIDT = array(); $sDelimiter = \DBAdapter::getStringDelimiter(); $oCriteria = new \Criteria('workflow'); $oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_UID); $oCriteria->addAsColumn('INP_DOC_TITLE', 'C.CON_VALUE'); $oCriteria->addAlias('C', 'CONTENT'); $aConditions = array(); $aConditions[] = array(\StepSupervisorPeer::STEP_UID_OBJ, \InputDocumentPeer::INP_DOC_UID); $aConditions[] = array(\StepSupervisorPeer::STEP_TYPE_OBJ, $sDelimiter . 'INPUT_DOCUMENT' . $sDelimiter); $oCriteria->addJoinMC($aConditions, \Criteria::LEFT_JOIN); $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(\StepSupervisorPeer::PRO_UID, $sProcessUID); $oCriteria->add(\StepSupervisorPeer::STEP_UID_OBJ, $sInputDocumentUID); $oCriteria->add(\StepSupervisorPeer::STEP_TYPE_OBJ, 'INPUT_DOCUMENT'); $oCriteria->addAscendingOrderByColumn(\StepSupervisorPeer::STEP_POSITION); $oDataset = \StepSupervisorPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); $oDataset->next(); while ($aRow = $oDataset->getRow()) { $sPuUIDT = $aRow['STEP_UID']; $oDataset->next(); } if (sizeof($sPuUIDT) == 0) { $oStepSupervisor = new \StepSupervisor(); $oStepSupervisor->create(array('PRO_UID' => $sProcessUID, 'STEP_TYPE_OBJ' => "INPUT_DOCUMENT", 'STEP_UID_OBJ' => $sInputDocumentUID, 'STEP_POSITION' => $oStepSupervisor->getNextPosition($sProcessUID, "INPUT_DOCUMENT"))); $sDelimiter = \DBAdapter::getStringDelimiter(); $oCriteria = new \Criteria('workflow'); $oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_UID); $oCriteria->addSelectColumn(\StepSupervisorPeer::PRO_UID); $oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_TYPE_OBJ); $oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_UID_OBJ); $oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_POSITION); $oCriteria->addAsColumn('INP_DOC_TITLE', 'C.CON_VALUE'); $oCriteria->addAlias('C', 'CONTENT'); $aConditions = array(); $aConditions[] = array(\StepSupervisorPeer::STEP_UID_OBJ, \InputDocumentPeer::INP_DOC_UID); $aConditions[] = array(\StepSupervisorPeer::STEP_TYPE_OBJ, $sDelimiter . 'INPUT_DOCUMENT' . $sDelimiter); $oCriteria->addJoinMC($aConditions, \Criteria::LEFT_JOIN); $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(\StepSupervisorPeer::PRO_UID, $sProcessUID); $oCriteria->add(\StepSupervisorPeer::STEP_UID_OBJ, $sInputDocumentUID); $oCriteria->add(\StepSupervisorPeer::STEP_TYPE_OBJ, 'INPUT_DOCUMENT'); $oCriteria->addAscendingOrderByColumn(\StepSupervisorPeer::STEP_POSITION); $oDataset = \StepSupervisorPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); $oDataset->next(); while ($aRow = $oDataset->getRow()) { $aResp = array('pui_uid' => $aRow['STEP_UID'], 'pui_position' => $aRow['STEP_POSITION'], 'input_doc_uid' => $aRow['STEP_UID_OBJ']); $oDataset->next(); $aRespPosition = $this->updateProcessSupervisorInputDocument($sProcessUID ,$aRow['STEP_UID'], $sPuiPosition); $aResp = array_merge(array('input_doc_title' => $aRow['INP_DOC_TITLE']), $aRespPosition); } return $aResp; } else { throw new \Exception(\G::LoadTranslation("ID_RELATION_EXIST")); } }