public function executeDelete() { $task = TaskPeer::retrieveByUuid($this->getRequestParameter('task')); $this->forward404Unless($task); $task->delete(); return $this->redirect($this->getRequest()->getReferer()); }
public function executeUpdate() { $jira = new sfJiraPlugin($this->getUser()->getProfile()->getJiraLogin(), $this->getUser()->getProfile()->getJiraPassword()); $aProjects = $jira->getProjects(); foreach ($aProjects as $project) { #var_dump( $project ); $c = new Criteria(); $c->add(ProjectPeer::USER_ID, $this->getUser()->getProfile()->getId()); $c->add(ProjectPeer::KEY, $project->key); $p = ProjectPeer::doSelectOne($c); $c = new Criteria(); $c->add(UserPeer::JIRA_LOGIN, $project->lead); $u = UserPeer::doSelectOne($c); if (empty($p)) { $p = new Project(); $p->setKey($project->key); $p->setLeadId(!empty($u) ? $u->getId() : null); $p->setUserId($this->getUser()->getProfile()->getId()); $p->setName($project->name); $p->setUpdated(date('r')); $p->save(); } $issues = $jira->getIssuesForProject($p->getKey()); foreach ($issues as $issue) { #die($p->getKey()); if ($issue->assignee == $this->getUser()->getProfile()->getJiraLogin()) { $c = new Criteria(); $c->add(TaskPeer::KEY, $issue->key); $t = TaskPeer::doSelectOne($c); if (empty($t)) { $c = new Criteria(); $c->add(UserPeer::JIRA_LOGIN, $issue->reporter); $u = UserPeer::doSelectOne($c); $t = new Task(); $t->setProjectId($p->getId()); $t->setTitle($issue->summary); $t->setDescription($issue->description); $t->setKey($issue->key); $t->setUpdated(date('r')); $t->setStatusId($issue->status); $t->setPriorityId($issue->priority); $t->setLeadId(!empty($u) ? $u->getId() : null); $t->save(); } } } } $this->redirect('@homepage'); return sfView::NONE; }
/** * Verify if doesn't exists the Task * * @param string $processUid Unique id of Process * @param string $taskUid Unique id of Task * @param string $fieldNameForException Field name for the exception * * return void Throw exception if doesn't exists the Task */ public function throwExceptionIfNotExistsTask($processUid, $taskUid, $fieldNameForException) { try { $criteria = new \Criteria("workflow"); $criteria->addSelectColumn(\TaskPeer::TAS_UID); if ($processUid != "") { $criteria->add(\TaskPeer::PRO_UID, $processUid, \Criteria::EQUAL); } $criteria->add(\TaskPeer::TAS_UID, $taskUid, \Criteria::EQUAL); $rsCriteria = \TaskPeer::doSelectRS($criteria); if (!$rsCriteria->next()) { throw new \Exception(\G::LoadTranslation("ID_ACTIVITY_DOES_NOT_EXIST", array($fieldNameForException, $taskUid))); } } catch (\Exception $e) { throw $e; } }
function doDerivation ($currentDelegation, $nextDel, $appFields, $aSP = null) { $iAppThreadIndex = $appFields['DEL_THREAD']; $delType = 'NORMAL'; if (is_numeric( $nextDel['DEL_PRIORITY'] )) { $nextDel['DEL_PRIORITY'] = (isset( $nextDel['DEL_PRIORITY'] ) ? ($nextDel['DEL_PRIORITY'] >= 1 && $nextDel['DEL_PRIORITY'] <= 5 ? $nextDel['DEL_PRIORITY'] : '3') : '3'); } else { $nextDel['DEL_PRIORITY'] = 3; } switch ($nextDel['TAS_ASSIGN_TYPE']) { case 'CANCEL_MI': case 'STATIC_MI': // Create new delegation depending on the no of users in the group $iNewAppThreadIndex = $appFields['DEL_THREAD']; $this->case->closeAppThread( $currentDelegation['APP_UID'], $iAppThreadIndex ); foreach ($nextDel['NEXT_TASK']['USER_ASSIGNED'] as $key => $aValue) { //Incrementing the Del_thread First so that new delegation has new del_thread $iNewAppThreadIndex += 1; //Creating new delegation according to users in group $iMIDelIndex = $this->case->newAppDelegation( $appFields['PRO_UID'], $currentDelegation['APP_UID'], $nextDel['TAS_UID'], (isset( $aValue['USR_UID'] ) ? $aValue['USR_UID'] : ''), $currentDelegation['DEL_INDEX'], $nextDel['DEL_PRIORITY'], $delType, $iNewAppThreadIndex, $nextDel ); $iNewThreadIndex = $this->case->newAppThread( $currentDelegation['APP_UID'], $iMIDelIndex, $iAppThreadIndex ); //Setting the del Index for Updating the AppThread delIndex if ($key == 0) { $iNewDelIndex = $iMIDelIndex - 1; } } //end foreach break; case 'BALANCED': $this->setTasLastAssigned( $nextDel['TAS_UID'], $nextDel['USR_UID'] ); //No Break, need no execute the default ones.... default: // Create new delegation $iNewDelIndex = $this->case->newAppDelegation( $appFields['PRO_UID'], $currentDelegation['APP_UID'], $nextDel['TAS_UID'], (isset( $nextDel['USR_UID'] ) ? $nextDel['USR_UID'] : ''), $currentDelegation['DEL_INDEX'], $nextDel['DEL_PRIORITY'], $delType, $iAppThreadIndex, $nextDel ); break; } $iAppThreadIndex = $appFields['DEL_THREAD']; switch ($currentDelegation['ROU_TYPE']) { case 'PARALLEL': case 'PARALLEL-BY-EVALUATION': $this->case->closeAppThread( $currentDelegation['APP_UID'], $iAppThreadIndex ); $iNewThreadIndex = $this->case->newAppThread( $currentDelegation['APP_UID'], $iNewDelIndex, $iAppThreadIndex ); $this->case->updateAppDelegation( $currentDelegation['APP_UID'], $iNewDelIndex, $iNewThreadIndex ); break; default: $this->case->updateAppThread( $currentDelegation['APP_UID'], $iAppThreadIndex, $iNewDelIndex ); break; } //en switch //if there are subprocess to create if (isset( $aSP )) { //Create the new case in the sub-process // set the initial date to null the time its created $aNewCase = $this->case->startCase( $aSP['TAS_UID'], $aSP['USR_UID'], true, $appFields); $taskNextDel = TaskPeer::retrieveByPK($aSP["TAS_UID"]); //Sub-Process //Copy case variables to sub-process case $aFields = unserialize( $aSP['SP_VARIABLES_OUT'] ); $aNewFields = array (); $aOldFields = $this->case->loadCase( $aNewCase['APPLICATION'] ); foreach ($aFields as $sOriginField => $sTargetField) { $sOriginField = trim($sOriginField, " @#%?$="); $sTargetField = trim($sTargetField, " @#%?$="); $aNewFields[$sTargetField] = isset( $appFields['APP_DATA'][$sOriginField] ) ? $appFields['APP_DATA'][$sOriginField] : ''; } $aOldFields['APP_DATA'] = array_merge( $aOldFields['APP_DATA'], $aNewFields ); $aOldFields['APP_STATUS'] = 'TO_DO'; $this->case->updateCase( $aNewCase['APPLICATION'], $aOldFields ); //Create a registry in SUB_APPLICATION table $aSubApplication = array ('APP_UID' => $aNewCase['APPLICATION'],'APP_PARENT' => $currentDelegation['APP_UID'],'DEL_INDEX_PARENT' => $iNewDelIndex,'DEL_THREAD_PARENT' => $iAppThreadIndex,'SA_STATUS' => 'ACTIVE','SA_VALUES_OUT' => serialize( $aNewFields ),'SA_INIT_DATE' => date( 'Y-m-d H:i:s' ) ); if ($aSP['SP_SYNCHRONOUS'] == 0) { $aSubApplication['SA_STATUS'] = 'FINISHED'; $aSubApplication['SA_FINISH_DATE'] = $aSubApplication['SA_INIT_DATE']; } $oSubApplication = new SubApplication(); $oSubApplication->create( $aSubApplication ); //Update the AppDelegation to execute the update trigger $AppDelegation = AppDelegationPeer::retrieveByPK( $aNewCase['APPLICATION'], $aNewCase['INDEX'] ); // note added by krlos pacha carlos[at]colosa[dot]com // the following line of code was commented because it is related to the 6878 bug //$AppDelegation->setDelInitDate("+1 second"); $AppDelegation->save(); //Create record in table APP_ASSIGN_SELF_SERVICE_VALUE if ($taskNextDel->getTasAssignType() == "SELF_SERVICE" && trim($taskNextDel->getTasGroupVariable()) != "") { $nextTaskGroupVariable = trim($taskNextDel->getTasGroupVariable(), " @#"); if (isset($aOldFields["APP_DATA"][$nextTaskGroupVariable]) && trim($aOldFields["APP_DATA"][$nextTaskGroupVariable]) != "") { $appAssignSelfServiceValue = new AppAssignSelfServiceValue(); $appAssignSelfServiceValue->create($aNewCase["APPLICATION"], $aNewCase["INDEX"], array("PRO_UID" => $aNewCase["PROCESS"], "TAS_UID" => $aSP["TAS_UID"], "GRP_UID" => trim($aOldFields["APP_DATA"][$nextTaskGroupVariable]))); } } //If not is SYNCHRONOUS derivate one more time if ($aSP['SP_SYNCHRONOUS'] == 0) { $this->case->setDelInitDate( $currentDelegation['APP_UID'], $iNewDelIndex ); $aDeriveTasks = $this->prepareInformation( array ('USER_UID' => -1,'APP_UID' => $currentDelegation['APP_UID'],'DEL_INDEX' => $iNewDelIndex ) ); if (isset( $aDeriveTasks[1] )) { if ($aDeriveTasks[1]['ROU_TYPE'] != 'SELECT') { $nextDelegations2 = array (); foreach ($aDeriveTasks as $aDeriveTask) { $nextDelegations2[] = array ('TAS_UID' => $aDeriveTask['NEXT_TASK']['TAS_UID'],'USR_UID' => $aDeriveTask['NEXT_TASK']['USER_ASSIGNED']['USR_UID'],'TAS_ASSIGN_TYPE' => $aDeriveTask['NEXT_TASK']['TAS_ASSIGN_TYPE'],'TAS_DEF_PROC_CODE' => $aDeriveTask['NEXT_TASK']['TAS_DEF_PROC_CODE'],'DEL_PRIORITY' => 3,'TAS_PARENT' => $aDeriveTask['NEXT_TASK']['TAS_PARENT'] ); } $currentDelegation2 = array ('APP_UID' => $currentDelegation['APP_UID'],'DEL_INDEX' => $iNewDelIndex,'APP_STATUS' => 'TO_DO','TAS_UID' => $currentDelegation['TAS_UID'],'ROU_TYPE' => $aDeriveTasks[1]['ROU_TYPE'] ); $this->derivate( $currentDelegation2, $nextDelegations2 ); } } } } //end switch return $iNewDelIndex; }
/** * derivate Case moves the case to the next task in the process according to the routing rules * * @param string $userId * @param string $caseId * @param string $delIndex * @param array $tasks * @param bool $bExecuteTriggersBeforeAssignment * @return $result will return an object */ public function derivateCase ($userId, $caseId, $delIndex, $bExecuteTriggersBeforeAssignment = false, $tasks = array()) { $g = new G(); try { $g->sessionVarSave(); $_SESSION["APPLICATION"] = $caseId; $_SESSION["INDEX"] = $delIndex; $_SESSION["USER_LOGGED"] = $userId; $sStatus = 'TO_DO'; $varResponse = ''; $varTriggers = "\n"; if ($delIndex == '') { $oCriteria = new Criteria( 'workflow' ); $oCriteria->addSelectColumn( AppDelegationPeer::DEL_INDEX ); $oCriteria->add( AppDelegationPeer::APP_UID, $caseId ); $oCriteria->add( AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL ); if (AppDelegationPeer::doCount( $oCriteria ) > 1) { $result = new wsResponse( 20, G::loadTranslation( 'ID_SPECIFY_DELEGATION_INDEX' ) ); return $result; } $oDataset = AppDelegationPeer::doSelectRS( $oCriteria ); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); $oDataset->next(); $aRow = $oDataset->getRow(); $delIndex = $aRow['DEL_INDEX']; } $oAppDel = new AppDelegation(); $appdel = $oAppDel->Load( $caseId, $delIndex ); if ($userId != $appdel['USR_UID']) { $result = new wsResponse( 17, G::loadTranslation( 'ID_CASE_ASSIGNED_ANOTHER_USER' ) ); return $result; } if ($appdel['DEL_FINISH_DATE'] != null) { $result = new wsResponse( 18, G::loadTranslation( 'ID_CASE_DELEGATION_ALREADY_CLOSED' ) ); return $result; } $oCriteria = new Criteria( 'workflow' ); $oCriteria->addSelectColumn( AppDelayPeer::APP_UID ); $oCriteria->addSelectColumn( AppDelayPeer::APP_DEL_INDEX ); $oCriteria->add( AppDelayPeer::APP_TYPE, '' ); $oCriteria->add( $oCriteria->getNewCriterion( AppDelayPeer::APP_TYPE, 'PAUSE' )->addOr( $oCriteria->getNewCriterion( AppDelayPeer::APP_TYPE, 'CANCEL' ) ) ); $oCriteria->addAscendingOrderByColumn( AppDelayPeer::APP_ENABLE_ACTION_DATE ); $oDataset = AppDelayPeer::doSelectRS( $oCriteria ); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); $oDataset->next(); $aRow = $oDataset->getRow(); if (is_array( $aRow )) { if (isset( $aRow['APP_DISABLE_ACTION_USER'] ) && $aRow['APP_DISABLE_ACTION_USER'] != 0 && isset( $aRow['APP_DISABLE_ACTION_DATE'] ) && $aRow['APP_DISABLE_ACTION_DATE'] != '') { $result = new wsResponse( 19, G::loadTranslation( 'ID_CASE_IN_STATUS' ) . " " . $aRow['APP_TYPE'] ); return $result; } } $aData = array(); $aData['APP_UID'] = $caseId; $aData['DEL_INDEX'] = $delIndex; $aData['USER_UID'] = $userId; //Load data $oCase = new Cases(); $appFields = $oCase->loadCase( $caseId, $delIndex ); if (is_null( $appFields["DEL_INIT_DATE"] )) { $oCase->setDelInitDate( $caseId, $delIndex ); $appFields = $oCase->loadCase( $caseId, $delIndex ); } $appFields["APP_DATA"]["APPLICATION"] = $caseId; if (! isset( $_SESSION["PROCESS"] )) { $_SESSION["PROCESS"] = $appFields["PRO_UID"]; } if ($bExecuteTriggersBeforeAssignment) { //Execute triggers before assignment $aTriggers = $oCase->loadTriggers( $appdel['TAS_UID'], 'ASSIGN_TASK', - 1, 'BEFORE' ); if (count( $aTriggers ) > 0) { $varTriggers = $varTriggers . "<br /><b>-= Before Assignment =-</b><br />"; $oPMScript = new PMScript(); foreach ($aTriggers as $aTrigger) { //$appFields = $oCase->loadCase( $caseId ); //$appFields['APP_DATA']['APPLICATION'] = $caseId; //Set variables $params = new stdClass(); $params->appData = $appFields["APP_DATA"]; if ($this->stored_system_variables) { $params->option = "STORED SESSION"; $params->SID = $this->wsSessionId; } $appFields["APP_DATA"] = array_merge( $appFields["APP_DATA"], G::getSystemConstants( $params ) ); //PMScript $oPMScript->setFields( $appFields['APP_DATA'] ); $bExecute = true; if ($aTrigger['ST_CONDITION'] !== '') { $oPMScript->setScript( $aTrigger['ST_CONDITION'] ); $bExecute = $oPMScript->evaluate(); } if ($bExecute) { $oPMScript->setScript( $aTrigger['TRI_WEBBOT'] ); $oPMScript->execute(); $trigger = TriggersPeer::retrieveByPk($aTrigger["TRI_UID"]); $varTriggers = $varTriggers . " - " . nl2br(htmlentities($trigger->getTriTitle(), ENT_QUOTES)) . "<br />"; //$appFields = $oCase->loadCase( $caseId ); $appFields['APP_DATA'] = $oPMScript->aFields; unset($appFields['APP_STATUS']); unset($appFields['APP_PROC_STATUS']); unset($appFields['APP_PROC_CODE']); unset($appFields['APP_PIN']); $oCase->updateCase( $caseId, $appFields ); } } } } //Execute triggers before derivation BEFORE_ROUTING $aTriggers = $oCase->loadTriggers( $appdel['TAS_UID'], 'ASSIGN_TASK', - 2, 'BEFORE' ); if (count( $aTriggers ) > 0) { $varTriggers .= "<b>-= Before Derivation =-</b><br/>"; $oPMScript = new PMScript(); foreach ($aTriggers as $aTrigger) { //$appFields = $oCase->loadCase( $caseId ); //$appFields['APP_DATA']['APPLICATION'] = $caseId; //Set variables $params = new stdClass(); $params->appData = $appFields["APP_DATA"]; if ($this->stored_system_variables) { $params->option = "STORED SESSION"; $params->SID = $this->wsSessionId; } $appFields["APP_DATA"] = array_merge( $appFields["APP_DATA"], G::getSystemConstants( $params ) ); //PMScript $oPMScript->setFields( $appFields['APP_DATA'] ); $bExecute = true; if ($aTrigger['ST_CONDITION'] !== '') { $oPMScript->setScript( $aTrigger['ST_CONDITION'] ); $bExecute = $oPMScript->evaluate(); } if ($bExecute) { $oPMScript->setScript( $aTrigger['TRI_WEBBOT'] ); $oPMScript->execute(); $oTrigger = TriggersPeer::retrieveByPk( $aTrigger['TRI_UID'] ); $varTriggers .= " - " . nl2br( htmlentities( $oTrigger->getTriTitle(), ENT_QUOTES ) ) . "<br/>"; //$appFields = $oCase->loadCase( $caseId ); $appFields['APP_DATA'] = $oPMScript->aFields; unset($appFields['APP_STATUS']); unset($appFields['APP_PROC_STATUS']); unset($appFields['APP_PROC_CODE']); unset($appFields['APP_PIN']); //$appFields['APP_DATA']['APPLICATION'] = $caseId; $oCase->updateCase( $caseId, $appFields ); } } } $oDerivation = new Derivation(); if (!empty($tasks)) { $nextDelegations = $tasks; } else { $derive = $oDerivation->prepareInformation($aData); if (isset($derive[1])) { if ($derive[1]['ROU_TYPE'] == 'SELECT') { $result = new wsResponse(21, G::loadTranslation('ID_CAN_NOT_ROUTE_CASE_USING_WEBSERVICES')); return $result; } } else { $result = new wsResponse(22, G::loadTranslation('ID_TASK_DOES_NOT_HAVE_ROUTING_RULE')); return $result; } foreach ($derive as $key => $val) { if ($val['NEXT_TASK']['TAS_ASSIGN_TYPE'] == 'MANUAL') { $result = new wsResponse(15, G::loadTranslation('ID_TASK_DEFINED_MANUAL_ASSIGNMENT')); return $result; } //Routed to the next task, if end process then not exist user $nodeNext = array(); $usrasgdUid = null; $usrasgdUserName = null; if (isset($val['NEXT_TASK']['USER_ASSIGNED'])) { $usrasgdUid = $val['NEXT_TASK']['USER_ASSIGNED']['USR_UID']; $usrasgdUserName = '******' . $val['NEXT_TASK']['USER_ASSIGNED']['USR_USERNAME'] . ')'; } $nodeNext['TAS_UID'] = $val['NEXT_TASK']['TAS_UID']; $nodeNext['USR_UID'] = $usrasgdUid; $nodeNext['TAS_ASSIGN_TYPE'] = $val['NEXT_TASK']['TAS_ASSIGN_TYPE']; $nodeNext['TAS_DEF_PROC_CODE'] = $val['NEXT_TASK']['TAS_DEF_PROC_CODE']; $nodeNext['DEL_PRIORITY'] = $appdel['DEL_PRIORITY']; $nodeNext['TAS_PARENT'] = $val['NEXT_TASK']['TAS_PARENT']; $nextDelegations[] = $nodeNext; $varResponse = $varResponse . (($varResponse != '') ? ',' : '') . $val['NEXT_TASK']['TAS_TITLE'] . $usrasgdUserName; } } $appFields['DEL_INDEX'] = $delIndex; if (isset( $derive['TAS_UID'] )) { $appFields['TAS_UID'] = $derive['TAS_UID']; } //Save data - Start //$appFields = $oCase->loadCase( $caseId ); //$oCase->updateCase ( $caseId, $appFields ); //Save data - End $row = array (); $oCriteria = new Criteria( 'workflow' ); $del = DBAdapter::getStringDelimiter(); $oCriteria->addSelectColumn( RoutePeer::ROU_TYPE ); $oCriteria->addSelectColumn( RoutePeer::ROU_NEXT_TASK ); $oCriteria->add( RoutePeer::TAS_UID, $appdel['TAS_UID'] ); $oDataset = TaskPeer::doSelectRS( $oCriteria ); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); $oDataset->next(); while ($aRow = $oDataset->getRow()) { $row[] = array ('ROU_TYPE' => $aRow['ROU_TYPE'],'ROU_NEXT_TASK' => $aRow['ROU_NEXT_TASK'] ); $oDataset->next(); } //derivate case $aCurrentDerivation = array ('APP_UID' => $caseId,'DEL_INDEX' => $delIndex,'APP_STATUS' => $sStatus,'TAS_UID' => $appdel['TAS_UID'],'ROU_TYPE' => $row[0]['ROU_TYPE'] ); $oDerivation->derivate( $aCurrentDerivation, $nextDelegations ); $appFields = $oCase->loadCase( $caseId ); //Execute triggers after derivation $aTriggers = $oCase->loadTriggers( $appdel['TAS_UID'], 'ASSIGN_TASK', - 2, 'AFTER' ); if (count( $aTriggers ) > 0) { //$appFields['APP_DATA']['APPLICATION'] = $caseId; //Set variables $params = new stdClass(); $params->appData = $appFields["APP_DATA"]; if ($this->stored_system_variables) { $params->option = "STORED SESSION"; $params->SID = $this->wsSessionId; } $appFields["APP_DATA"] = array_merge( $appFields["APP_DATA"], G::getSystemConstants( $params ) ); //PMScript $oPMScript = new PMScript(); $oPMScript->setFields( $appFields['APP_DATA'] ); $varTriggers .= "<b>-= After Derivation =-</b><br/>"; foreach ($aTriggers as $aTrigger) { $bExecute = true; if ($aTrigger['ST_CONDITION'] !== '') { $oPMScript->setScript( $aTrigger['ST_CONDITION'] ); $bExecute = $oPMScript->evaluate(); } if ($bExecute) { $oPMScript->setScript( $aTrigger['TRI_WEBBOT'] ); $oPMScript->execute(); $oTrigger = TriggersPeer::retrieveByPk( $aTrigger['TRI_UID'] ); $varTriggers .= " - " . nl2br( htmlentities( $oTrigger->getTriTitle(), ENT_QUOTES ) ) . "<br/>"; //$appFields = $oCase->loadCase($caseId); $appFields['APP_DATA'] = $oPMScript->aFields; //$appFields['APP_DATA']['APPLICATION'] = $caseId; //$appFields = $oCase->loadCase($caseId); unset($aFields['APP_STATUS']); unset($aFields['APP_PROC_STATUS']); unset($aFields['APP_PROC_CODE']); unset($aFields['APP_PIN']); $oCase->updateCase( $caseId, $appFields ); } } } $sFromName = ""; if ($userId != "") { $user = new Users(); $arrayUserData = $user->load($userId); if (trim($arrayUserData["USR_EMAIL"]) == "") { $arrayUserData["USR_EMAIL"] = "info@" . $_SERVER["HTTP_HOST"]; } $sFromName = "\"" . $arrayUserData["USR_FIRSTNAME"] . " " . $arrayUserData["USR_LASTNAME"] . "\" <" . $arrayUserData["USR_EMAIL"] . ">"; } $oCase->sendNotifications( $appdel['TAS_UID'], $nextDelegations, $appFields['APP_DATA'], $caseId, $delIndex, $sFromName ); // Send notifications Mobile - Start try { $oLight = new \ProcessMaker\BusinessModel\Light(); $nextIndex = $oLight->getInformationDerivatedCase($appFields['APP_UID'], $delIndex); $notificationMobile = new \ProcessMaker\BusinessModel\Light\NotificationDevice(); $notificationMobile->routeCaseNotification($userId, $_SESSION["PROCESS"], $appdel['TAS_UID'], $appFields, $nextDelegations, $nextIndex); } catch (Exception $e) { \G::log(G::loadTranslation( 'ID_NOTIFICATION_ERROR' ) . '|' . $e->getMessage() , PATH_DATA, "mobile.log"); } // Send notifications Mobile - End //Save data - Start //$appFields = $oCase->loadCase($caseId); //$oCase->updateCase($caseId, $appFields); //Save data - End $oProcess = new Process(); $oProcessFieds = $oProcess->Load( $appFields['PRO_UID'] ); //here dubug mode in web entry if (isset( $oProcessFieds['PRO_DEBUG'] ) && $oProcessFieds['PRO_DEBUG']) { $result = new wsResponse( 0, $varResponse . " <br><br><table width='100%' cellpadding='0' cellspacing='0'><tr><td class='FormTitle'> " . G::LoadTranslation( 'ID_DEBUG_MESSAGE' ) . "</td></tr></table>" . $varTriggers ); } else { $result = new wsResponse( 0, $varResponse . " --- " . $oProcessFieds['PRO_DEBUG'] ); } $res = $result->getPayloadArray(); //now fill the array of AppDelegationPeer $oCriteria = new Criteria( 'workflow' ); $oCriteria->addSelectColumn( AppDelegationPeer::DEL_INDEX ); $oCriteria->addSelectColumn( AppDelegationPeer::USR_UID ); $oCriteria->addSelectColumn( AppDelegationPeer::TAS_UID ); $oCriteria->addSelectColumn( AppDelegationPeer::DEL_THREAD ); $oCriteria->addSelectColumn( AppDelegationPeer::DEL_THREAD_STATUS ); $oCriteria->addSelectColumn( AppDelegationPeer::DEL_FINISH_DATE ); $oCriteria->add( AppDelegationPeer::APP_UID, $caseId ); $oCriteria->add( AppDelegationPeer::DEL_PREVIOUS, $delIndex ); $oCriteria->addAscendingOrderByColumn( AppDelegationPeer::DEL_INDEX ); $oDataset = AppDelegationPeer::doSelectRS( $oCriteria ); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); $aCurrentUsers = array (); while ($oDataset->next()) { $aAppDel = $oDataset->getRow(); $oUser = new Users(); try { $oUser->load( $aAppDel['USR_UID'] ); $uFields = $oUser->toArray( BasePeer::TYPE_FIELDNAME ); $currentUserName = $oUser->getUsrFirstname() . ' ' . $oUser->getUsrLastname(); } catch (Exception $e) { $currentUserName = ''; } $oTask = new Task(); try { $uFields = $oTask->load( $aAppDel['TAS_UID'] ); $taskName = $uFields['TAS_TITLE']; } catch (Exception $e) { $taskName = ''; } // execute events $eventPro = $_SESSION["PROCESS"]; $eventApp = $caseId; $eventInd = $aAppDel['DEL_INDEX']; $eventTas = $aAppDel['TAS_UID']; $oEvent = new Event(); $oEvent->createAppEvents( $eventPro, $eventApp, $eventInd, $eventTas ); // end events $currentUser = new stdClass(); $currentUser->userId = $aAppDel['USR_UID']; $currentUser->userName = $currentUserName; $currentUser->taskId = $aAppDel['TAS_UID']; $currentUser->taskName = $taskName; $currentUser->delIndex = $aAppDel['DEL_INDEX']; $currentUser->delThread = $aAppDel['DEL_THREAD']; $currentUser->delThreadStatus = $aAppDel['DEL_THREAD_STATUS']; $aCurrentUsers[] = $currentUser; } $res['routing'] = $aCurrentUsers; $g->sessionVarRestore(); return $res; } catch (Exception $e) { $result = new wsResponse( 100, $e->getMessage() ); $g->sessionVarRestore(); return $result; } }
/** * 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); } }
/** * Implementation for 'GET' method for Rest API * * @param mixed $tasUid 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 get($tasUid = null) { $result = array(); try { $noArguments = true; $argumentList = func_get_args(); foreach ($argumentList as $arg) { if (!is_null($arg)) { $noArguments = false; } } if ($noArguments) { $criteria = new Criteria('workflow'); $criteria->addSelectColumn(TaskPeer::PRO_UID); $criteria->addSelectColumn(TaskPeer::TAS_UID); $criteria->addSelectColumn(TaskPeer::TAS_TYPE); $criteria->addSelectColumn(TaskPeer::TAS_DURATION); $criteria->addSelectColumn(TaskPeer::TAS_DELAY_TYPE); $criteria->addSelectColumn(TaskPeer::TAS_TEMPORIZER); $criteria->addSelectColumn(TaskPeer::TAS_TYPE_DAY); $criteria->addSelectColumn(TaskPeer::TAS_TIMEUNIT); $criteria->addSelectColumn(TaskPeer::TAS_ALERT); $criteria->addSelectColumn(TaskPeer::TAS_PRIORITY_VARIABLE); $criteria->addSelectColumn(TaskPeer::TAS_ASSIGN_TYPE); $criteria->addSelectColumn(TaskPeer::TAS_ASSIGN_VARIABLE); $criteria->addSelectColumn(TaskPeer::TAS_GROUP_VARIABLE); $criteria->addSelectColumn(TaskPeer::TAS_MI_INSTANCE_VARIABLE); $criteria->addSelectColumn(TaskPeer::TAS_MI_COMPLETE_VARIABLE); $criteria->addSelectColumn(TaskPeer::TAS_ASSIGN_LOCATION); $criteria->addSelectColumn(TaskPeer::TAS_ASSIGN_LOCATION_ADHOC); $criteria->addSelectColumn(TaskPeer::TAS_TRANSFER_FLY); $criteria->addSelectColumn(TaskPeer::TAS_LAST_ASSIGNED); $criteria->addSelectColumn(TaskPeer::TAS_USER); $criteria->addSelectColumn(TaskPeer::TAS_CAN_UPLOAD); $criteria->addSelectColumn(TaskPeer::TAS_VIEW_UPLOAD); $criteria->addSelectColumn(TaskPeer::TAS_VIEW_ADDITIONAL_DOCUMENTATION); $criteria->addSelectColumn(TaskPeer::TAS_CAN_CANCEL); $criteria->addSelectColumn(TaskPeer::TAS_OWNER_APP); $criteria->addSelectColumn(TaskPeer::STG_UID); $criteria->addSelectColumn(TaskPeer::TAS_CAN_PAUSE); $criteria->addSelectColumn(TaskPeer::TAS_CAN_SEND_MESSAGE); $criteria->addSelectColumn(TaskPeer::TAS_CAN_DELETE_DOCS); $criteria->addSelectColumn(TaskPeer::TAS_SELF_SERVICE); $criteria->addSelectColumn(TaskPeer::TAS_START); $criteria->addSelectColumn(TaskPeer::TAS_TO_LAST_USER); $criteria->addSelectColumn(TaskPeer::TAS_SEND_LAST_EMAIL); $criteria->addSelectColumn(TaskPeer::TAS_DERIVATION); $criteria->addSelectColumn(TaskPeer::TAS_POSX); $criteria->addSelectColumn(TaskPeer::TAS_POSY); $criteria->addSelectColumn(TaskPeer::TAS_WIDTH); $criteria->addSelectColumn(TaskPeer::TAS_HEIGHT); $criteria->addSelectColumn(TaskPeer::TAS_COLOR); $criteria->addSelectColumn(TaskPeer::TAS_EVN_UID); $criteria->addSelectColumn(TaskPeer::TAS_BOUNDARY); $criteria->addSelectColumn(TaskPeer::TAS_DERIVATION_SCREEN_TPL); $dataset = AppEventPeer::doSelectRS($criteria); $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); while ($dataset->next()) { $result[] = $dataset->getRow(); } } else { $record = TaskPeer::retrieveByPK($tasUid); if ($record) { $result = $record->toArray(BasePeer::TYPE_FIELDNAME); } else { $paramValues = ""; foreach ($argumentList as $arg) { $paramValues .= strlen($paramValues) ? ', ' : ''; if (!is_null($arg)) { $paramValues .= "{$arg}"; } else { $paramValues .= "NULL"; } } throw new RestException(417, "table Task ({$paramValues})"); } } } catch (RestException $e) { throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } return $result; }
} G::LoadClass('processes'); $infoProcess = new Processes(); if(!$infoProcess->processExists($proUid)) { $oSL = new SwimlanesElements(); if($oSL->swimlanesElementsExists($proUid)) { $aFields = $oSL->load($proUid); $proUid = $aFields['PRO_UID']; } else { $k = new Criteria('workflow'); $k->clearSelectColumns(); $k->addSelectColumn(TaskPeer::PRO_UID); $k->add(TaskPeer::TAS_UID, $uidAux ); $rs = TaskPeer::doSelectRS($k); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rs->next(); $row = $rs->getRow(); $proUid = $row['PRO_UID']; } } $resultProcess = $infoProcess->getProcessRow($proUid); } else { if(array_key_exists('PU_UID', $oDataAux)) { $c = new Criteria('workflow'); $c->clearSelectColumns(); $c->addSelectColumn(ProcessUserPeer::PRO_UID); $c->addSelectColumn(ProcessUserPeer::USR_UID); $c->add(ProcessUserPeer::PU_UID, $oData->PU_UID); $oDataset = AppDelegationPeer::doSelectRS($c);
if (!in_array($filters['sort'], $columnsList)) { $filters['sort'] = ''; } $filters['dir'] = G::toUpper($filters['dir']); if (!($filters['dir'] == 'DESC' || $filters['dir'] == 'ASC')) { $filters['dir'] = 'DESC'; } $result = $list->loadList($userUid, $filters, function (array $record) { try { if (isset($record["DEL_PREVIOUS_USR_UID"])) { if ($record["DEL_PREVIOUS_USR_UID"] == "") { $appDelegation = AppDelegationPeer::retrieveByPK($record["APP_UID"], $record["DEL_INDEX"]); if (!is_null($appDelegation)) { $appDelegationPrevious = AppDelegationPeer::retrieveByPK($record["APP_UID"], $appDelegation->getDelPrevious()); if (!is_null($appDelegationPrevious)) { $taskPrevious = TaskPeer::retrieveByPK($appDelegationPrevious->getTasUid()); if (!is_null($taskPrevious)) { switch ($taskPrevious->getTasType()) { case "SCRIPT-TASK": $record["DEL_PREVIOUS_USR_UID"] = $taskPrevious->getTasType(); break; } } } } } $record["PREVIOUS_USR_UID"] = $record["DEL_PREVIOUS_USR_UID"]; $record["PREVIOUS_USR_USERNAME"] = $record["DEL_PREVIOUS_USR_USERNAME"]; $record["PREVIOUS_USR_FIRSTNAME"] = $record["DEL_PREVIOUS_USR_FIRSTNAME"]; $record["PREVIOUS_USR_LASTNAME"] = $record["DEL_PREVIOUS_USR_LASTNAME"]; }
/** * Get the list of groups of unassigned users of the specified task from * database * * @param string $ProUID * Process identifier * @param string $TaskUID * task identifier * @return array of unassigned user groups */ public function getTaskUnassignedUsersGroupsData($ProUID, $TaskUID) { $unassignedUsersGroups = array(); $c = new Criteria(); $c->addSelectColumn(TaskUserPeer::USR_UID); $c->addSelectColumn(TaskUserPeer::TU_RELATION); $aConditions = array(); $aConditions[] = array(TaskPeer::TAS_UID, TaskUserPeer::TAS_UID); $aConditions[] = array(TaskPeer::TAS_ASSIGN_TYPE, DBAdapter::getStringDelimiter() . 'SELF_SERVICE' . DBAdapter::getStringDelimiter()); $c->addJoinMC($aConditions, Criteria::JOIN); $c->add(TaskPeer::PRO_UID, $ProUID); $c->add(TaskPeer::TAS_UID, $TaskUID); $rs = TaskPeer::doSelectRS($c); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); // echo $c->toString(); $rs->next(); $row = $rs->getRow(); while (is_array($row)) { $unassignedUsersGroups[] = $row; $rs->next(); $row = $rs->getRow(); } return $unassignedUsersGroups; }
public function deleteProcess($sProcessUID, $flagRemoveCases = true) { try { //G::LoadClass('case'); //G::LoadClass('reportTables'); //Instance all classes necesaries $oProcess = new \Process(); $oDynaform = new \Dynaform(); $oInputDocument = new \InputDocument(); $oOutputDocument = new \OutputDocument(); $oTrigger = new \Triggers(); $oRoute = new \Route(); $oGateway = new \Gateway(); $oEvent = new \Event(); $oSwimlaneElement = new \SwimlanesElements(); $oConfiguration = new \Configuration(); $oDbSource = new \DbSource(); $oReportTable = new \ReportTables(); $oCaseTracker = new \CaseTracker(); $oCaseTrackerObject = new \CaseTrackerObject(); //Update PROCESS_FILES_CHECKED $configuration = \ConfigurationPeer::retrieveByPK("PROCESS_FILES_CHECKED", "", "", "", ""); if (!is_null($configuration)) { $arrayProjectUid = unserialize($configuration->getCfgValue()); unset($arrayProjectUid[$sProcessUID]); $conf = new \Configuration(); $result = $conf->update(array("CFG_UID" => "PROCESS_FILES_CHECKED", "OBJ_UID" => "", "CFG_VALUE" => serialize($arrayProjectUid), "PRO_UID" => "", "USR_UID" => "", "APP_UID" => "")); } //Delete the applications of process if ($flagRemoveCases) { $case = new \Cases(); $criteria = new \Criteria("workflow"); $criteria->addSelectColumn(\ApplicationPeer::APP_UID); $criteria->add(\ApplicationPeer::PRO_UID, $sProcessUID, \Criteria::EQUAL); $rsCriteria = \ApplicationPeer::doSelectRS($criteria); $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); while ($rsCriteria->next()) { $row = $rsCriteria->getRow(); $result = $case->removeCase($row["APP_UID"]); } } //Delete the tasks of process $oCriteria = new Criteria('workflow'); $oCriteria->add(\TaskPeer::PRO_UID, $sProcessUID); $oDataset = \TaskPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); while ($aRow = $oDataset->getRow()) { //$this->deleteTask($aRow['TAS_UID']); $oTasks = new \Tasks(); $oTasks->deleteTask($aRow['TAS_UID']); $oDataset->next(); } //Delete the dynaforms of process $oCriteria = new Criteria('workflow'); $oCriteria->add(\DynaformPeer::PRO_UID, $sProcessUID); $oDataset = \DynaformPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); while ($aRow = $oDataset->getRow()) { $oDynaform->remove($aRow['DYN_UID']); $oDataset->next(); } //Delete the input documents of process $oCriteria = new Criteria('workflow'); $oCriteria->add(\InputDocumentPeer::PRO_UID, $sProcessUID); $oDataset = \InputDocumentPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); while ($aRow = $oDataset->getRow()) { $oInputDocument->remove($aRow['INP_DOC_UID']); $oDataset->next(); } //Delete the output documents of process $oCriteria = new Criteria('workflow'); $oCriteria->add(\OutputDocumentPeer::PRO_UID, $sProcessUID); $oDataset = \OutputDocumentPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); while ($aRow = $oDataset->getRow()) { $oOutputDocument->remove($aRow['OUT_DOC_UID']); $oDataset->next(); } //Delete the triggers of process $oCriteria = new Criteria('workflow'); $oCriteria->add(\TriggersPeer::PRO_UID, $sProcessUID); $oDataset = \TriggersPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); while ($aRow = $oDataset->getRow()) { $oTrigger->remove($aRow['TRI_UID']); $oDataset->next(); } //Delete the routes of process $oCriteria = new Criteria('workflow'); $oCriteria->add(\RoutePeer::PRO_UID, $sProcessUID); $oDataset = \RoutePeer::doSelectRS($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); while ($aRow = $oDataset->getRow()) { $oRoute->remove($aRow['ROU_UID']); $oDataset->next(); } //Delete the gateways of process $oCriteria = new Criteria('workflow'); $oCriteria->add(\GatewayPeer::PRO_UID, $sProcessUID); $oDataset = \GatewayPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); while ($aRow = $oDataset->getRow()) { $oGateway->remove($aRow['GAT_UID']); $oDataset->next(); } //Delete the Event of process $oCriteria = new Criteria('workflow'); $oCriteria->add(\EventPeer::PRO_UID, $sProcessUID); $oDataset = \EventPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); while ($aRow = $oDataset->getRow()) { $oEvent->remove($aRow['EVN_UID']); $oDataset->next(); } //Delete the swimlanes elements of process $oCriteria = new Criteria('workflow'); $oCriteria->add(\SwimlanesElementsPeer::PRO_UID, $sProcessUID); $oDataset = \SwimlanesElementsPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); while ($aRow = $oDataset->getRow()) { $oSwimlaneElement->remove($aRow['SWI_UID']); $oDataset->next(); } //Delete the configurations of process $oCriteria = new Criteria('workflow'); $oCriteria->add(\ConfigurationPeer::PRO_UID, $sProcessUID); $oDataset = \ConfigurationPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); while ($aRow = $oDataset->getRow()) { $oConfiguration->remove($aRow['CFG_UID'], $aRow['OBJ_UID'], $aRow['PRO_UID'], $aRow['USR_UID'], $aRow['APP_UID']); $oDataset->next(); } //Delete the DB sources of process $oCriteria = new Criteria('workflow'); $oCriteria->add(\DbSourcePeer::PRO_UID, $sProcessUID); $oDataset = \DbSourcePeer::doSelectRS($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); while ($aRow = $oDataset->getRow()) { /** * note added by gustavo cruz gustavo-at-colosa-dot-com 27-01-2010 * in order to solve the bug 0004389, we use the validation function Exists * inside the remove function in order to verify if the DbSource record * exists in the Database, however there is a strange behavior within the * propel engine, when the first record is erased somehow the "_deleted" * attribute of the next row is set to true, so when propel tries to erase * it, obviously it can't and trows an error. With the "Exist" function * we ensure that if there is the record in the database, the _delete attribute must be false. * * note added by gustavo cruz gustavo-at-colosa-dot-com 28-01-2010 * I have just identified the source of the issue, when is created a $oDbSource DbSource object * it's used whenever a record is erased or removed in the db, however the problem * it's that the same object is used every time, and the delete method invoked * sets the _deleted attribute to true when its called, of course as we use * the same object, the first time works fine but trowns an error with the * next record, cos it's the same object and the delete method checks if the _deleted * attribute it's true or false, the attrib _deleted is setted to true the * first time and later is never changed, the issue seems to be part of * every remove function in the model classes, not only DbSource * i recommend that a more general solution must be achieved to resolve * this issue in every model class, to prevent future problems. */ $oDbSource->remove($aRow['DBS_UID'], $sProcessUID); $oDataset->next(); } //Delete the supervisors $oCriteria = new Criteria('workflow'); $oCriteria->add(\ProcessUserPeer::PRO_UID, $sProcessUID); \ProcessUserPeer::doDelete($oCriteria); //Delete the object permissions $oCriteria = new Criteria('workflow'); $oCriteria->add(\ObjectPermissionPeer::PRO_UID, $sProcessUID); \ObjectPermissionPeer::doDelete($oCriteria); //Delete the step supervisors $oCriteria = new Criteria('workflow'); $oCriteria->add(\StepSupervisorPeer::PRO_UID, $sProcessUID); \StepSupervisorPeer::doDelete($oCriteria); //Delete the report tables $oCriteria = new Criteria('workflow'); $oCriteria->add(\ReportTablePeer::PRO_UID, $sProcessUID); $oDataset = \ReportTablePeer::doSelectRS($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); while ($aRow = $oDataset->getRow()) { $oReportTable->deleteReportTable($aRow['REP_TAB_UID']); $oDataset->next(); } //Delete case tracker configuration $oCaseTracker->remove($sProcessUID); //Delete case tracker objects $oCriteria = new Criteria('workflow'); $oCriteria->add(\CaseTrackerObjectPeer::PRO_UID, $sProcessUID); \ProcessUserPeer::doDelete($oCriteria); //Delete SubProcess $criteria = new \Criteria("workflow"); $criteria->add(\SubProcessPeer::PRO_PARENT, $sProcessUID, \Criteria::EQUAL); $result = \SubProcessPeer::doDelete($criteria); //Delete WebEntries $webEntry = new \ProcessMaker\BusinessModel\WebEntry(); $criteria = new \Criteria("workflow"); $criteria->addSelectColumn(\WebEntryPeer::WE_UID); $criteria->add(\WebEntryPeer::PRO_UID, $sProcessUID, \Criteria::EQUAL); $rsCriteria = \WebEntryPeer::doSelectRS($criteria); $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); while ($rsCriteria->next()) { $row = $rsCriteria->getRow(); $webEntry->delete($row["WE_UID"]); } //Delete WebEntry-Events $webEntryEvent = new \ProcessMaker\BusinessModel\WebEntryEvent(); $criteria = new \Criteria("workflow"); $criteria->addSelectColumn(\WebEntryEventPeer::WEE_UID); $criteria->add(\WebEntryEventPeer::PRJ_UID, $sProcessUID, \Criteria::EQUAL); $rsCriteria = \WebEntryEventPeer::doSelectRS($criteria); $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); while ($rsCriteria->next()) { $row = $rsCriteria->getRow(); $webEntryEvent->delete($row["WEE_UID"]); } //Delete MessageTypes $messageType = new \ProcessMaker\BusinessModel\MessageType(); $criteria = new \Criteria("workflow"); $criteria->addSelectColumn(\MessageTypePeer::MSGT_UID); $criteria->add(\MessageTypePeer::PRJ_UID, $sProcessUID, \Criteria::EQUAL); $rsCriteria = \MessageTypePeer::doSelectRS($criteria); $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); while ($rsCriteria->next()) { $row = $rsCriteria->getRow(); $messageType->delete($row["MSGT_UID"]); } //Delete Message-Event-Relation $messageEventRelation = new \ProcessMaker\BusinessModel\MessageEventRelation(); $messageEventRelation->deleteWhere(array(\MessageEventRelationPeer::PRJ_UID => $sProcessUID)); //Delete Message-Event-Task-Relation $elementTaskRelation = new \ProcessMaker\BusinessModel\ElementTaskRelation(); $elementTaskRelation->deleteWhere(array(\ElementTaskRelationPeer::PRJ_UID => $sProcessUID)); //Delete Message-Event-Definition $messageEventDefinition = new \ProcessMaker\BusinessModel\MessageEventDefinition(); $criteria = new \Criteria("workflow"); $criteria->addSelectColumn(\MessageEventDefinitionPeer::MSGED_UID); $criteria->add(\MessageEventDefinitionPeer::PRJ_UID, $sProcessUID, \Criteria::EQUAL); $rsCriteria = \MessageEventDefinitionPeer::doSelectRS($criteria); $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); while ($rsCriteria->next()) { $row = $rsCriteria->getRow(); $messageEventDefinition->delete($row["MSGED_UID"]); } //Delete Script-Task $scriptTask = new \ProcessMaker\BusinessModel\ScriptTask(); $scriptTask->deleteWhere(array(\ScriptTaskPeer::PRJ_UID => array($sProcessUID, \Criteria::EQUAL))); //Delete Timer-Event $timerEvent = new \ProcessMaker\BusinessModel\TimerEvent(); $timerEvent->deleteWhere(array(\TimerEventPeer::PRJ_UID => array($sProcessUID, \Criteria::EQUAL))); //Delete Email-Event $emailEvent = new \ProcessMaker\BusinessModel\EmailEvent(); $criteria = new \Criteria("workflow"); $criteria->addSelectColumn(\EmailEventPeer::EMAIL_EVENT_UID); $criteria->add(\EmailEventPeer::PRJ_UID, $sProcessUID, \Criteria::EQUAL); $rsCriteria = \EmailEventPeer::doSelectRS($criteria); $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); while ($rsCriteria->next()) { $row = $rsCriteria->getRow(); $emailEvent->delete($sProcessUID, $row["EMAIL_EVENT_UID"], false); } //Delete files Manager $filesManager = new \ProcessMaker\BusinessModel\FilesManager(); $criteria = new \Criteria("workflow"); $criteria->addSelectColumn(\ProcessFilesPeer::PRF_UID); $criteria->add(\ProcessFilesPeer::PRO_UID, $sProcessUID, \Criteria::EQUAL); $rsCriteria = \ProcessFilesPeer::doSelectRS($criteria); $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); while ($rsCriteria->next()) { $row = $rsCriteria->getRow(); $filesManager->deleteProcessFilesManager($sProcessUID, $row["PRF_UID"]); } //Delete the actions by email $oCriteria = new Criteria('workflow'); $oCriteria->add(\AbeConfigurationPeer::PRO_UID, $sProcessUID); \AbeConfigurationPeer::doDelete($oCriteria); //Delete the process try { $oProcess->remove($sProcessUID); } catch (\Exception $oError) { throw $oError; } return true; } catch (\Exception $oError) { throw $oError; } }
$oDataset = StagePeer::doSelectRS($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); while ($aRow1 = $oDataset->getRow()) { $oStage = new stdclass(); $oStage->uid = $aRow1['STG_UID']; $oStage->label = strip_tags($aRow1['CON_VALUE']); $oStage->position = new stdclass(); $oStage->position->x = (int) $aRow1['STG_POSX']; $oStage->position->y = (int) $aRow1['STG_POSY']; $oStage->derivation = new stdclass(); $oStage->derivation->to = array(); if (!$oData->mode) { $oCriteria = new Criteria('workflow'); $oCriteria->add(TaskPeer::STG_UID, $aRow1['STG_UID']); $oDataset1 = TaskPeer::doSelectRS($oCriteria); $oDataset1->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset1->next(); $aTasks = array(); while ($aRow2 = $oDataset1->getRow()) { $aTasks[] = $aRow2['TAS_UID']; $oDataset1->next(); } $oCriteria = new Criteria('workflow'); $oCriteria->add(AppDelegationPeer::APP_UID, $_SESSION['APPLICATION']); $oCriteria->add(AppDelegationPeer::TAS_UID, $aTasks, Criteria::IN); $oCriteria->add($oCriteria->getNewCriterion(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL)->addOr($oCriteria->getNewCriterion(AppDelegationPeer::DEL_FINISH_DATE, ''))); if (AppDelegationPeer::doCount($oCriteria) > 0) { $oStage->color = '#FF0000'; } else { $oCriteria = new Criteria('workflow');
public function executeAjaxSetTaskStatus() { //[0]Complete|[1]In Progress|[2]Pending/Planning|(2,+Inf]Unknown task status code $task = TaskPeer::retrieveByUuid($this->getRequestParameter('task')); $this->forward404Unless($task, 'Task not found in action, unable to update status'); $status = $this->getRequestParameter('task-status'); $this->forward404Unless(is_numeric($status)); if ($task->isAuthorized()) { $this->logMessage('Unauthorize to make changes to task'); $task->setStatus($status); $task->save(); } else { $this->logMessage('Unauthorize to make changes to task'); } $this->task = $task; $this->projectUsers = $this->task->getProject()->getApprovedUsers(); }
/** * get user's SelfService tasks * @param string $sUIDUser * @return $rows */ public function getSelfServiceTasks($userUid = '') { $rows[] = array(); $tasks = array(); //check self service tasks assigned directly to this user $c = new Criteria(); $c->clearSelectColumns(); $c->addSelectColumn(TaskPeer::TAS_UID); $c->addSelectColumn(TaskPeer::PRO_UID); $c->addJoin(TaskPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN); $c->addJoin(TaskPeer::TAS_UID, TaskUserPeer::TAS_UID, Criteria::LEFT_JOIN); $c->add(ProcessPeer::PRO_STATUS, 'ACTIVE'); $c->add(TaskPeer::TAS_ASSIGN_TYPE, 'SELF_SERVICE'); $c->add(TaskPeer::TAS_GROUP_VARIABLE, ''); $c->add(TaskUserPeer::USR_UID, $userUid); $rs = TaskPeer::doSelectRS($c); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rs->next(); $row = $rs->getRow(); while (is_array($row)) { $tasks[] = $row['TAS_UID']; $rs->next(); $row = $rs->getRow(); } //check groups assigned to SelfService task G::LoadClass('groups'); $group = new Groups(); $aGroups = $group->getActiveGroupsForAnUser($userUid); $c = new Criteria(); $c->clearSelectColumns(); $c->addSelectColumn(TaskPeer::TAS_UID); $c->addSelectColumn(TaskPeer::PRO_UID); $c->addJoin(TaskPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN); $c->addJoin(TaskPeer::TAS_UID, TaskUserPeer::TAS_UID, Criteria::LEFT_JOIN); $c->add(ProcessPeer::PRO_STATUS, 'ACTIVE'); $c->add(TaskPeer::TAS_ASSIGN_TYPE, 'SELF_SERVICE'); $c->add(TaskPeer::TAS_GROUP_VARIABLE, ''); $c->add(TaskUserPeer::USR_UID, $aGroups, Criteria::IN); $rs = TaskPeer::doSelectRS($c); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rs->next(); $row = $rs->getRow(); while (is_array($row)) { $tasks[] = $row['TAS_UID']; $rs->next(); $row = $rs->getRow(); } return $tasks; }
public function getSortedTasks($sort_by, $dir = 'asc') { return TaskPeer::retrieveSortedByProjectId($this->getId(), $sort_by, $dir); }
public function getSelfServiceCasesByEvaluate($userUid) { $cases = array(); //check groups assigned to SelfService task G::LoadClass('groups'); $group = new Groups(); $aGroups = $group->getActiveGroupsForAnUser($userUid); $c = new Criteria(); $c->clearSelectColumns(); $c->addSelectColumn(TaskPeer::TAS_UID); $c->addSelectColumn(TaskPeer::PRO_UID); $c->addSelectColumn(TaskPeer::TAS_GROUP_VARIABLE); $c->addJoin(TaskPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN); $c->addJoin(TaskPeer::TAS_UID, TaskUserPeer::TAS_UID, Criteria::LEFT_JOIN); $c->add(ProcessPeer::PRO_STATUS, 'ACTIVE'); $c->add(TaskPeer::TAS_ASSIGN_TYPE, 'SELF_SERVICE'); $c->add(TaskPeer::TAS_GROUP_VARIABLE, '', Criteria::NOT_EQUAL); $rs = TaskPeer::doSelectRS($c); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rs->next(); if ($rs->getRecordCount() > 0) { if (!class_exists('Cases')) { G::loadClass('case'); } $caseInstance = new Cases(); while ($row = $rs->getRow()) { $tasGroupVariable = str_replace(array('@', '#'), '', $row['TAS_GROUP_VARIABLE']); $c2 = new Criteria(); $c2->clearSelectColumns(); $c2->addSelectColumn(AppDelegationPeer::APP_UID); $c2->add(AppDelegationPeer::TAS_UID, $row['TAS_UID']); $c2->add(AppDelegationPeer::USR_UID, ''); $c2->add(AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN'); $rs2 = AppDelegationPeer::doSelectRS($c2); $rs2->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rs2->next(); while ($row2 = $rs2->getRow()) { $caseData = $caseInstance->LoadCase($row2['APP_UID']); if (isset($caseData['APP_DATA'][$tasGroupVariable])) { if (trim($caseData['APP_DATA'][$tasGroupVariable]) != '') { if (in_array(trim($caseData['APP_DATA'][$tasGroupVariable]), $aGroups)) { $cases[] = $row2['APP_UID']; } } } $rs2->next(); } $rs->next(); } } return $cases; }
public function assignUsersTask($param) { try { require_once 'classes/model/TaskUser.php'; require_once 'classes/model/Task.php'; $oTaskUser = new TaskUser(); $UIDS = explode(',', $param['UIDS']); $TU_TYPE = 1; foreach ($UIDS as $UID) { if ($_POST['TU_RELATION'] == 1) { $oTaskUser->create(array('TAS_UID' => $param['TAS_UID'], 'USR_UID' => $UID, 'TU_TYPE' => $TU_TYPE, 'TU_RELATION' => 1)); } else { $oTaskUser->create(array('TAS_UID' => $param['TAS_UID'], 'USR_UID' => $UID, 'TU_TYPE' => $TU_TYPE, 'TU_RELATION' => 2)); } } $task = TaskPeer::retrieveByPk($param['TAS_UID']); $result->success = true; if (count($UIDS) > 1) { $result->msg = __('ID_ACTORS_ASSIGNED_SUCESSFULLY', SYS_LANG, array(count($UIDS), $task->getTasTitle())); } else { $result->msg = __('ID_ACTOR_ASSIGNED_SUCESSFULLY', SYS_LANG, array('tas_title' => $task->getTasTitle())); } } catch (Exception $e) { $result->success = false; $result->msg = $e->getMessage(); } print G::json_encode($result); }
/** * Configuration functions * * @param string $UsrUid * @param string $ProUid * @param string $TasUid * @return void */ public function prepareInformation($UsrUid = null, $ProUid = null, $TasUid = null) { // setup calendarDays according the task if (isset($TasUid)) { $task = TaskPeer::retrieveByPK($TasUid); if (!is_null($task)) { $this->calendarDays = $task->getTasTypeDay() == 2; } } //get an array with all holidays. $aoHolidays = HolidayPeer::doSelect(new Criteria()); $holidays = array(); foreach ($aoHolidays as $holiday) { $holidays[] = strtotime($holiday->getHldDate()); } // by default the weekdays are from monday to friday $this->weekends = array(0, 6); $this->holidays = $holidays; return; }
/** * 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(TaskPeer::TAS_UID, $pks, Criteria::IN); $objs = TaskPeer::doSelect($criteria, $con); } return $objs; }
public function updateCase($sAppUid, $Fields = array()) { try { $aApplicationFields = $Fields['APP_DATA']; $Fields['APP_UID'] = $sAppUid; $Fields['APP_UPDATE_DATE'] = 'now'; $Fields['APP_DATA'] = serialize($Fields['APP_DATA']); /* $oApp = new Application; $appFields = $oApp->load($sAppUid); */ $oApp = ApplicationPeer::retrieveByPk($sAppUid); $appFields = $oApp->toArray(BasePeer::TYPE_FIELDNAME); if (isset($Fields['APP_TITLE'])) { $appFields['APP_TITLE'] = $Fields['APP_TITLE']; } if (isset($Fields['APP_DESCRIPTION'])) { $appFields['APP_DESCRIPTION'] = $Fields['APP_DESCRIPTION']; } $newValues = $this->newRefreshCaseTitleAndDescription($sAppUid, $appFields, $aApplicationFields); //Start: Save History --By JHL if (isset($Fields['CURRENT_DYNAFORM'])) { //only when that variable is set.. from Save $FieldsBefore = $this->loadCase($sAppUid); $FieldsDifference = $this->arrayRecursiveDiff($FieldsBefore['APP_DATA'], $aApplicationFields); $fieldsOnBoth = array_intersect_assoc($FieldsBefore['APP_DATA'], $aApplicationFields); //Add fields that weren't in previous version foreach ($aApplicationFields as $key => $value) { if (!isset($fieldsOnBoth[$key])) { $FieldsDifference[$key] = $value; } } if (is_array($FieldsDifference) && count($FieldsDifference) > 0) { //There are changes $appHistory = new AppHistory(); $aFieldsHistory = $Fields; $aFieldsHistory['APP_DATA'] = serialize($FieldsDifference); $appHistory->insertHistory($aFieldsHistory); } } //End Save History //we are removing the app_title and app_description from this array, //because they already be updated in newRefreshCaseTitleAndDescription function if (isset($Fields['APP_TITLE'])) { unset($Fields['APP_TITLE']); } if (isset($Fields['APP_DESCRIPTION'])) { unset($Fields['APP_DESCRIPTION']); } $oApp->update($Fields); $DEL_INDEX = isset($Fields['DEL_INDEX']) ? $Fields['DEL_INDEX'] : ''; $TAS_UID = isset($Fields['TAS_UID']) ? $Fields['TAS_UID'] : ''; G::LoadClass('reportTables'); require_once 'classes/model/AdditionalTables.php'; $oReportTables = new ReportTables(); $addtionalTables = new additionalTables(); $oReportTables->updateTables($appFields['PRO_UID'], $sAppUid, $Fields['APP_NUMBER'], $aApplicationFields); $addtionalTables->updateReportTables($appFields['PRO_UID'], $sAppUid, $Fields['APP_NUMBER'], $aApplicationFields); //now update the priority in appdelegation table, using the defined variable in task if (trim($DEL_INDEX) != '' && trim($TAS_UID) != '') { //optimized code to avoid load task content row. $c = new Criteria(); $c->clearSelectColumns(); $c->addSelectColumn(TaskPeer::TAS_PRIORITY_VARIABLE); $c->add(TaskPeer::TAS_UID, $TAS_UID); $rs = TaskPeer::doSelectRS($c); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rs->next(); $row = $rs->getRow(); $VAR_PRI = substr($row['TAS_PRIORITY_VARIABLE'], 2); //end optimized code. $x = unserialize($Fields['APP_DATA']); if (isset($x[$VAR_PRI])) { if (trim($x[$VAR_PRI]) != '') { $oDel = new AppDelegation(); $array = array(); $array['APP_UID'] = $sAppUid; $array['DEL_INDEX'] = $DEL_INDEX; $array['TAS_UID'] = $TAS_UID; $array['DEL_PRIORITY'] = isset($x[$VAR_PRI]) ? $x[$VAR_PRI] >= 1 && $x[$VAR_PRI] <= 5 ? $x[$VAR_PRI] : '3' : '3'; $oDel->update($array); } } } //Update Solr Index if ($this->appSolr != null) { $this->appSolr->updateApplicationSearchIndex($sAppUid); } return $Fields; } catch (exception $e) { throw $e; } }
/** * Assign actors to task * * @param unknown_type $param */ public function assignActorsTask($param) { require_once 'classes/model/TaskUser.php'; require_once 'classes/model/Task.php'; $oTaskUser = new TaskUser(); $UIDS = explode(',', $param->UIDS); $TU_TYPE = $param->TU_TYPE; $TAS_UID = $param->TAS_UID; foreach ($UIDS as $UID) { if ($param->TU_RELATION == '1') { $res[] = $oTaskUser->create(array('TAS_UID' => $TAS_UID, 'USR_UID' => $UID, 'TU_TYPE' => $TU_TYPE, 'TU_RELATION' => 1)); } else { $res[] = $oTaskUser->create(array('TAS_UID' => $TAS_UID, 'USR_UID' => $UID, 'TU_TYPE' => $TU_TYPE, 'TU_RELATION' => 2)); } } $task = TaskPeer::retrieveByPk($TAS_UID); $this->success = true; if (!in_array('-1', $res)) { if (count($UIDS) == 1) { $this->msg = __('ID_ACTOR_ASSIGNED_SUCESSFULLY', SYS_LANG, array('tas_title' => $task->getTasTitle())); } else { $this->msg = __('ID_ACTORS_ASSIGNED_SUCESSFULLY', SYS_LANG, array(count($UIDS), $task->getTasTitle())); } } else { if (count($UIDS) == 1) { $this->msg = __('ID_ACTOR_ALREADY_ASSIGNED', SYS_LANG, array($task->getTasTitle())); } else { $this->msg = __('ID_SOME_ACTORS_ALREADY_ASSIGNED', SYS_LANG, array($task->getTasTitle())); } } }
public function getMaximunTaskX($processUid) { $criteria = new Criteria('workflow'); $criteria->addSelectColumn('MAX(TAS_POSX) AS MAX_X'); $criteria->add(TaskPeer::PRO_UID, $processUid); $dataset = TaskPeer::doSelectRS($criteria); $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $dataset->next(); $row = $dataset->getRow(); return (int) $row['MAX_X']; }
/** * Create List Completed Table * * @param type $data * @return type * */ public function create($data) { $criteria = new Criteria(); $criteria->addSelectColumn(ListCompletedPeer::APP_UID); $criteria->add( ListCompletedPeer::APP_UID, $data['APP_UID'], Criteria::EQUAL ); $dataset = ListCompletedPeer::doSelectRS($criteria); $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); if ($dataset->next()) { return 1; } $criteria = new Criteria(); $criteria->addSelectColumn(ContentPeer::CON_VALUE); $criteria->add( ContentPeer::CON_ID, $data['APP_UID'], Criteria::EQUAL ); $criteria->add( ContentPeer::CON_CATEGORY, 'APP_TITLE', Criteria::EQUAL ); $criteria->add( ContentPeer::CON_LANG, SYS_LANG, Criteria::EQUAL ); $dataset = ContentPeer::doSelectRS($criteria); $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $dataset->next(); $aRow = $dataset->getRow(); $data['APP_TITLE'] = $aRow['CON_VALUE']; $criteria = new Criteria(); $criteria->addSelectColumn(ContentPeer::CON_VALUE); $criteria->add( ContentPeer::CON_ID, $data['PRO_UID'], Criteria::EQUAL ); $criteria->add( ContentPeer::CON_CATEGORY, 'PRO_TITLE', Criteria::EQUAL ); $criteria->add( ContentPeer::CON_LANG, SYS_LANG, Criteria::EQUAL ); $dataset = ContentPeer::doSelectRS($criteria); $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $dataset->next(); $aRow = $dataset->getRow(); $data['APP_PRO_TITLE'] = $aRow['CON_VALUE']; $criteria = new Criteria(); $criteria->addSelectColumn(ContentPeer::CON_VALUE); $criteria->add( ContentPeer::CON_ID, $data['TAS_UID'], Criteria::EQUAL ); $criteria->add( ContentPeer::CON_CATEGORY, 'TAS_TITLE', Criteria::EQUAL ); $criteria->add( ContentPeer::CON_LANG, SYS_LANG, Criteria::EQUAL ); $dataset = ContentPeer::doSelectRS($criteria); $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $dataset->next(); $aRow = $dataset->getRow(); $data['APP_TAS_TITLE'] = $aRow['CON_VALUE']; $criteria = new Criteria(); $criteria->addSelectColumn(UsersPeer::USR_USERNAME); $criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME); $criteria->addSelectColumn(UsersPeer::USR_LASTNAME); $criteria->add( UsersPeer::USR_UID, $data['USR_UID'], Criteria::EQUAL ); $dataset = UsersPeer::doSelectRS($criteria); $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $dataset->next(); $aRow = $dataset->getRow(); $data['DEL_CURRENT_USR_USERNAME'] = $aRow['USR_USERNAME']; $data['DEL_CURRENT_USR_FIRSTNAME'] = $aRow['USR_FIRSTNAME']; $data['DEL_CURRENT_USR_LASTNAME'] = $aRow['USR_LASTNAME']; $data['DEL_PREVIOUS'] = isset($data['DEL_PREVIOUS']) ? $data['DEL_PREVIOUS'] : ""; if ($data['DEL_PREVIOUS'] != 0) { $criteria = new Criteria(); $criteria->addSelectColumn(AppDelegationPeer::USR_UID); $criteria->add( AppDelegationPeer::DEL_INDEX, $data['DEL_PREVIOUS'], Criteria::EQUAL ); $dataset = UsersPeer::doSelectRS($criteria); $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $dataset->next(); $aRow = $dataset->getRow(); $data['DEL_PREVIOUS_USR_UID'] = $aRow['USR_UID']; } //Update - WHERE $criteriaWhere = new Criteria("workflow"); $criteriaWhere->add(ListParticipatedLastPeer::APP_UID, $data["APP_UID"], Criteria::EQUAL); //Update - SET $criteriaSet = new Criteria("workflow"); $criteriaSet->add(ListParticipatedLastPeer::APP_STATUS, 'COMPLETED'); BasePeer::doUpdate($criteriaWhere, $criteriaSet, Propel::getConnection("workflow")); $users = new Users(); $users->refreshTotal($data['USR_UID'], 'add', 'completed'); if ($data['DEL_PREVIOUS'] != 0) { $criteria = new Criteria(); $criteria->addSelectColumn(TaskPeer::TAS_TYPE); $criteria->add( TaskPeer::TAS_UID, $data['TAS_UID'], Criteria::EQUAL ); $dataset = TaskPeer::doSelectRS($criteria); $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $dataset->next(); $aRow = $dataset->getRow(); if ($aRow['TAS_TYPE'] != 'SUBPROCESS') { $users->refreshTotal($data['USR_UID'], 'remove', 'inbox'); } } else { $criteria = new Criteria(); $criteria->addSelectColumn(SubApplicationPeer::APP_UID); $criteria->add( SubApplicationPeer::APP_UID, $data['APP_UID'], Criteria::EQUAL ); $dataset = SubApplicationPeer::doSelectRS($criteria); $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); if ($dataset->next()) { $users->refreshTotal($data['USR_UID'], 'remove', 'inbox'); } else { $users->refreshTotal($data['USR_UID'], 'remove', 'draft'); } } $con = Propel::getConnection( ListCompletedPeer::DATABASE_NAME ); try { $this->fromArray( $data, BasePeer::TYPE_FIELDNAME ); if ($this->validate()) { $result = $this->save(); } else { $e = new Exception( "Failed Validation in class " . get_class( $this ) . "." ); $e->aValidationFailures = $this->getValidationFailures(); throw ($e); } $con->commit(); return $result; } catch(Exception $e) { $con->rollback(); throw ($e); } }
/** * Method to invalidate the instance pool of all tables related to projects * by a foreign key with ON DELETE CASCADE */ public static function clearRelatedInstancePool() { // invalidate objects in TaskPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. TaskPeer::clearInstancePool(); // invalidate objects in BuildPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule. BuildPeer::clearInstancePool(); }
public function getTaskDescription () { $c = new Criteria( 'workflow' ); $c->clearSelectColumns(); $c->addSelectColumn( TaskPeer::TAS_UID ); $oDataset = TaskPeer::doSelectRS( $c ); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); $oDataset->next(); $aRows = Array (); while ($aRow = $oDataset->getRow()) { $aRows[] = $aRow; $oDataset->next(); } foreach ($aRows as $k => $aRow) { $oTask = new Task(); $aTaskRow = $oTask->load( $aRow['TAS_UID'] ); $aRows[$k] = array_merge( $aRow, array ('TAS_TITLE' => $aTaskRow['TAS_TITLE'] ), array ('PRO_UID' => $aTaskRow['PRO_UID'] ) ); } return $aRows; }
public function startCase($sTasUid, $sUsrUid, $isSubprocess = false, $dataPreviusApplication = array()) { if ($sTasUid != '') { try { $task = TaskPeer::retrieveByPK($sTasUid); if (is_null($task)) { throw new Exception(G::LoadTranslation("ID_TASK_NOT_EXIST", array("TAS_UID", $sTasUid))); } //To allow Self Service as the first task $arrayTaskTypeToExclude = array("START-TIMER-EVENT"); if (!is_null($task) && !in_array($task->getTasType(), $arrayTaskTypeToExclude) && $task->getTasAssignType() != "SELF_SERVICE" && $sUsrUid == "") { throw (new Exception('You tried to start a new case without send the USER UID!')); } //Process $sProUid = $task->getProUid(); $this->Process = new Process; $proFields = $this->Process->Load($sProUid); //application $Application = new Application; $sAppUid = $Application->create($sProUid, $sUsrUid); //appDelegation $AppDelegation = new AppDelegation; $iAppThreadIndex = 1; // Start Thread $iAppDelPrio = 3; // Priority $iDelIndex = $AppDelegation->createAppDelegation( $sProUid, $sAppUid, $sTasUid, $sUsrUid, $iAppThreadIndex, $iAppDelPrio, $isSubprocess ); //appThread $AppThread = new AppThread; $iAppThreadIndex = $AppThread->createAppThread($sAppUid, $iDelIndex, 0); //DONE: Al ya existir un delegation, se puede "calcular" el caseTitle. $Fields = $Application->toArray(BasePeer::TYPE_FIELDNAME); $aApplicationFields = $Fields['APP_DATA']; $newValues = $this->newRefreshCaseTitleAndDescription($sAppUid, $Fields, $aApplicationFields); if (!isset($newValues['APP_TITLE'])) { $newValues['APP_TITLE'] = ''; } $caseNumber = $Fields['APP_NUMBER']; $Application->update($Fields); //Update the task last assigned (for web entry and web services) G::LoadClass('derivation'); $oDerivation = new Derivation(); $oDerivation->setTasLastAssigned($sTasUid, $sUsrUid); // Execute Events require_once 'classes/model/Event.php'; $event = new Event(); $event->createAppEvents($sProUid, $sAppUid, $iDelIndex, $sTasUid); //update searchindex if ($this->appSolr != null) { $this->appSolr->updateApplicationSearchIndex($sAppUid); } /*----------------------------------********---------------------------------*/ } catch (exception $e) { throw ($e); } } else { throw (new Exception('You tried to start a new case without send the USER UID or TASK UID!')); } //call plugin if (class_exists('folderData')) { $folderData = new folderData( $sProUid, $proFields['PRO_TITLE'], $sAppUid, $newValues['APP_TITLE'], $sUsrUid ); $oPluginRegistry = &PMPluginRegistry::getSingleton(); $oPluginRegistry->executeTriggers(PM_CREATE_CASE, $folderData); } //end plugin return array( 'APPLICATION' => $sAppUid, 'INDEX' => $iDelIndex, 'PROCESS' => $sProUid, 'CASE_NUMBER' => $caseNumber ); }
if (isset($aValues['NEXT_TASK']['TAS_DEF_PROC_CODE'])) { $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_DEF_PROC_CODE'] = '<input type="hidden" name="' . $hiddenName . '[TAS_DEF_PROC_CODE]" id="' . $hiddenName . '[TAS_DEF_PROC_CODE]" value="' . $aValues['NEXT_TASK']['TAS_DEF_PROC_CODE'] . '">'; } else { $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_DEF_PROC_CODE'] = '<input type="hidden" name="' . $hiddenName . '[TAS_DEF_PROC_CODE]" id="' . $hiddenName . '[TAS_DEF_PROC_CODE]" value="">'; } $aFields['TASK'][$sKey]['NEXT_TASK']['DEL_PRIORITY'] = '<input type="hidden" name="' . $hiddenName . '[DEL_PRIORITY]" id="' . $hiddenName . '[DEL_PRIORITY]" value="' . $sPriority . '">'; $aFields['TASK'][$sKey]['NEXT_TASK']['TAS_PARENT'] = '<input type="hidden" name="' . $hiddenName . '[TAS_PARENT]" id="' . $hiddenName . '[TAS_PARENT]" value="' . $aValues['NEXT_TASK']['TAS_PARENT'] . '">'; } } $aFields['PROCESSING_MESSAGE'] = G::loadTranslation('ID_PROCESSING'); /** * New Feature: Derivation Screen can be personalized * @author Erik Amaru Ortiz <*****@*****.**> */ $tplFile = 'cases/cases_ScreenDerivation'; $task = TaskPeer::retrieveByPk($_SESSION['TASK']); $tasDerivationScreenTpl = $task->getTasDerivationScreenTpl(); if (!empty($tasDerivationScreenTpl)) { //erik: first, verify if the task has a personalized template (for derivation screen) $tplFile = $tasDerivationScreenTpl; $tplFile = PATH_DATA_MAILTEMPLATES . $aFields['PROCESS']['PRO_UID'] . PATH_SEP . $tplFile; } else { //erik: verify if the process has a personalized template (for derivation screen) if (!empty($aFields['PROCESS']['PRO_DERIVATION_SCREEN_TPL'])) { $tplFile = $aFields['PROCESS']['PRO_DERIVATION_SCREEN_TPL']; $tplFile = PATH_DATA_MAILTEMPLATES . $aFields['PROCESS']['PRO_UID'] . PATH_SEP . $tplFile; } } $G_PUBLISH->AddContent('smarty', $tplFile, '', '', $aFields); /* if (isset( $aFields['TASK'][1]['NEXT_TASK']['USER_ASSIGNED'])){
public function calculateDueDate($sNextTasParam) { //Get Task properties $task = TaskPeer::retrieveByPK($this->getTasUid()); $aData['TAS_UID'] = $this->getTasUid(); //Added to allow User defined Timing Control at Run time from Derivation screen if (isset($sNextTasParam['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY']) && $sNextTasParam['NEXT_TASK']['TAS_TRANSFER_HIDDEN_FLY'] == 'true') { $aData['TAS_DURATION'] = $sNextTasParam['NEXT_TASK']['TAS_DURATION']; $aData['TAS_TIMEUNIT'] = $sNextTasParam['NEXT_TASK']['TAS_TIMEUNIT']; $aData['TAS_TYPE_DAY'] = $sNextTasParam['NEXT_TASK']['TAS_TYPE_DAY']; if (isset($sNextTasParam['NEXT_TASK']['TAS_CALENDAR']) && $sNextTasParam['NEXT_TASK']['TAS_CALENDAR'] != '') { $aCalendarUID = $sNextTasParam['NEXT_TASK']['TAS_CALENDAR']; } else { $aCalendarUID = ''; } //Updating the task Table , so that user will see updated values in the assign screen in consequent cases $oTask = new Task(); $oTask->update($aData); } else { if (is_null($task)) { return 0; } $aData['TAS_DURATION'] = $task->getTasDuration(); $aData['TAS_TIMEUNIT'] = $task->getTasTimeUnit(); $aData['TAS_TYPE_DAY'] = $task->getTasTypeDay(); $aCalendarUID = ''; } //use the dates class to calculate dates $calendar = new calendar(); if ($calendar->pmCalendarUid == '') { $calendar->getCalendar(null, $task->getProUid(), $aData['TAS_UID']); $calendar->getCalendarData(); } $iDueDate = $calendar->calculateDate($this->getDelDelegateDate(), $aData['TAS_DURATION'], $aData['TAS_TIMEUNIT']); return $iDueDate; }
function lookinginforContentProcess($sproUid) { require_once 'classes/model/Content.php'; require_once 'classes/model/Task.php'; require_once 'classes/model/Content.php'; $oContent = new Content(); ///we are looking for a pro title for this process $sproUid $oCriteria = new Criteria('workflow'); $oCriteria->add(ContentPeer::CON_CATEGORY, 'PRO_TITLE'); $oCriteria->add(ContentPeer::CON_LANG, 'en'); $oCriteria->add(ContentPeer::CON_ID, $sproUid); $oDataset = ContentPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); $aRow = $oDataset->getRow(); if (!is_array($aRow)) { $oC = new Criteria('workflow'); $oC->addSelectColumn(TaskPeer::TAS_UID); $oC->add(TaskPeer::PRO_UID, $sproUid); $oDataset1 = TaskPeer::doSelectRS($oC); $oDataset1->setFetchmode(ResultSet::FETCHMODE_ASSOC); while ($oDataset1->next()) { $aRow1 = $oDataset1->getRow(); $oCriteria1 = new Criteria('workflow'); $oCriteria1->add(ContentPeer::CON_CATEGORY, 'TAS_TITLE'); $oCriteria1->add(ContentPeer::CON_LANG, SYS_LANG); $oCriteria1->add(ContentPeer::CON_ID, $aRow1['TAS_UID']); $oDataset2 = ContentPeer::doSelectRS($oCriteria1); $oDataset2->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset2->next(); $aRow2 = $oDataset2->getRow(); Content::insertContent('TAS_TITLE', '', $aRow2['CON_ID'], 'en', $aRow2['CON_VALUE']); } $oC2 = new Criteria('workflow'); $oC2->add(ContentPeer::CON_CATEGORY, 'PRO_TITLE'); $oC2->add(ContentPeer::CON_LANG, SYS_LANG); $oC2->add(ContentPeer::CON_ID, $sproUid); $oDataset3 = ContentPeer::doSelectRS($oC2); $oDataset3->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset3->next(); $aRow3 = $oDataset3->getRow(); Content::insertContent('PRO_TITLE', '', $aRow3['CON_ID'], 'en', $aRow3['CON_VALUE']); } return 1; }
function setTasLastAssigned($tasUid, $usrUid) { try { $oTask = TaskPeer::retrieveByPk($tasUid); $oTask->setTasLastAssigned($usrUid); $oTask->save(); } catch (Exception $e) { throw $e; } }