/** * Implementation for 'POST' method for Rest API * * @param mixed $appUid, $appThreadIndex 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 post($appUid, $appThreadIndex, $appThreadParent, $appThreadStatus, $delIndex) { try { $result = array(); $obj = new AppThread(); $obj->setAppUid($appUid); $obj->setAppThreadIndex($appThreadIndex); $obj->setAppThreadParent($appThreadParent); $obj->setAppThreadStatus($appThreadStatus); $obj->setDelIndex($delIndex); $obj->save(); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } }
public function reassignCase($sApplicationUID, $iDelegation, $sUserUID, $newUserUID, $sType = 'REASSIGN') { $this->CloseCurrentDelegation($sApplicationUID, $iDelegation); $oAppDelegation = new AppDelegation(); $aFieldsDel = $oAppDelegation->Load($sApplicationUID, $iDelegation); $iIndex = $oAppDelegation->createAppDelegation( $aFieldsDel['PRO_UID'], $aFieldsDel['APP_UID'], $aFieldsDel['TAS_UID'], $aFieldsDel['USR_UID'], $aFieldsDel['DEL_THREAD'] ); $aData = array(); $aData['APP_UID'] = $aFieldsDel['APP_UID']; $aData['DEL_INDEX'] = $iIndex; $aData['DEL_PREVIOUS'] = $aFieldsDel['DEL_PREVIOUS']; $aData['DEL_TYPE'] = $aFieldsDel['DEL_TYPE']; $aData['DEL_PRIORITY'] = $aFieldsDel['DEL_PRIORITY']; $aData['DEL_DELEGATE_DATE'] = $aFieldsDel['DEL_DELEGATE_DATE']; $aData['USR_UID'] = $newUserUID; $aData['DEL_INIT_DATE'] = null; $aData['DEL_FINISH_DATE'] = null; $oAppDelegation->update($aData); $oAppThread = new AppThread(); $oAppThread->update( array( 'APP_UID' => $sApplicationUID, 'APP_THREAD_INDEX' => $aFieldsDel['DEL_THREAD'], 'DEL_INDEX' => $iIndex) ); //Save in APP_DELAY $oApplication = new Application(); $aFields = $oApplication->Load($sApplicationUID); $aData['PRO_UID'] = $aFieldsDel['PRO_UID']; $aData['APP_UID'] = $sApplicationUID; $aData['APP_THREAD_INDEX'] = $aFieldsDel['DEL_THREAD']; $aData['APP_DEL_INDEX'] = $iDelegation; $aData['APP_TYPE'] = ($sType != '' ? $sType : 'REASSIGN'); $aData['APP_STATUS'] = $aFields['APP_STATUS']; $aData['APP_DELEGATION_USER'] = $sUserUID; $aData['APP_ENABLE_ACTION_USER'] = $sUserUID; $aData['APP_ENABLE_ACTION_DATE'] = date('Y-m-d H:i:s'); $oAppDelay = new AppDelay(); $oAppDelay->create($aData); //update searchindex if ($this->appSolr != null) { $this->appSolr->updateApplicationSearchIndex($sApplicationUID); } /*----------------------------------********---------------------------------*/ $this->getExecuteTriggerProcess($sApplicationUID, 'REASSIGNED'); return true; }
/** * Validates all modified columns of given AppThread object. * If parameter $columns is either a single column name or an array of column names * than only those columns are validated. * * NOTICE: This does not apply to primary or foreign keys for now. * * @param AppThread $obj The object to validate. * @param mixed $cols Column name or array of column names. * * @return mixed TRUE if all columns are valid or the error message of the first invalid column. */ public static function doValidate(AppThread $obj, $cols = null) { $columns = array(); if ($cols) { $dbMap = Propel::getDatabaseMap(AppThreadPeer::DATABASE_NAME); $tableMap = $dbMap->getTable(AppThreadPeer::TABLE_NAME); if (!is_array($cols)) { $cols = array($cols); } foreach ($cols as $colName) { if ($tableMap->containsColumn($colName)) { $get = 'get' . $tableMap->getColumn($colName)->getPhpName(); $columns[$colName] = $obj->{$get}(); } } } else { if ($obj->isNew() || $obj->isColumnModified(AppThreadPeer::APP_THREAD_STATUS)) { $columns[AppThreadPeer::APP_THREAD_STATUS] = $obj->getAppThreadStatus(); } } return BasePeer::doValidate(AppThreadPeer::DATABASE_NAME, AppThreadPeer::TABLE_NAME, $columns); }