Code Style

This commit is contained in:
Paula Quispe
2017-12-07 12:33:21 -04:00
parent 0f1d3ef459
commit 9eb56f6c55

View File

@@ -4396,28 +4396,30 @@ class Cases
} }
/** /**
* reassign a case * Reassign a case
* *
* @name reassignCase * @name reassignCase
* @param string $sApplicationUID *
* @param string $iDelegation * @param string $appUid
* @param string $sUserUID * @param string $delIndex
* @param string $newUserUID * @param string $currentUserUid
* @param string $sType * @param string $newUserUid
* @param string $type
*
* @return true * @return true
*/ */
public function reassignCase($sApplicationUID, $iDelegation, $sUserUID, $newUserUID, $sType = 'REASSIGN') public function reassignCase($appUid, $delIndex, $currentUserUid, $newUserUid, $type = 'REASSIGN')
{ {
$this->CloseCurrentDelegation($sApplicationUID, $iDelegation); $this->CloseCurrentDelegation($appUid, $delIndex);
$user = UsersPeer::retrieveByPK($newUserUID); $user = UsersPeer::retrieveByPK($newUserUid);
$oAppDelegation = new AppDelegation(); $appDelegation = new AppDelegation();
$aFieldsDel = $oAppDelegation->Load($sApplicationUID, $iDelegation); $fieldsDel = $appDelegation->Load($appUid, $delIndex);
$iIndex = $oAppDelegation->createAppDelegation( $newDelIndex = $appDelegation->createAppDelegation(
$aFieldsDel['PRO_UID'], $fieldsDel['PRO_UID'],
$aFieldsDel['APP_UID'], $fieldsDel['APP_UID'],
$aFieldsDel['TAS_UID'], $fieldsDel['TAS_UID'],
(empty($user)) ? 0 : $user->getUsrId(), (empty($user)) ? 0 : $user->getUsrId(),
$aFieldsDel['DEL_THREAD'], $fieldsDel['DEL_THREAD'],
3, 3,
false, false,
-1, -1,
@@ -4425,79 +4427,80 @@ class Cases
false, false,
false, false,
0, 0,
$aFieldsDel['APP_NUMBER'], $fieldsDel['APP_NUMBER'],
$aFieldsDel['TAS_ID'], $fieldsDel['TAS_ID'],
(empty($user)) ? 0 : $user->getUsrId(), (empty($user)) ? 0 : $user->getUsrId(),
$aFieldsDel['PRO_ID'] $fieldsDel['PRO_ID']
); );
$newDelIndex = $iIndex;
$aData = array(); $newData = [];
$aData['APP_UID'] = $aFieldsDel['APP_UID']; $newData['APP_UID'] = $fieldsDel['APP_UID'];
$aData['DEL_INDEX'] = $iIndex; $newData['DEL_INDEX'] = $newDelIndex;
$aData['DEL_PREVIOUS'] = $aFieldsDel['DEL_PREVIOUS']; $newData['DEL_PREVIOUS'] = $fieldsDel['DEL_PREVIOUS'];
$aData['DEL_TYPE'] = $aFieldsDel['DEL_TYPE']; $newData['DEL_TYPE'] = $fieldsDel['DEL_TYPE'];
$aData['DEL_PRIORITY'] = $aFieldsDel['DEL_PRIORITY']; $newData['DEL_PRIORITY'] = $fieldsDel['DEL_PRIORITY'];
$aData['DEL_DELEGATE_DATE'] = $aFieldsDel['DEL_DELEGATE_DATE']; $newData['DEL_DELEGATE_DATE'] = $fieldsDel['DEL_DELEGATE_DATE'];
$aData['USR_UID'] = $newUserUID; $newData['USR_UID'] = $newUserUid;
$aData['DEL_INIT_DATE'] = null; $newData['DEL_INIT_DATE'] = null;
$aData['DEL_FINISH_DATE'] = null; $newData['DEL_FINISH_DATE'] = null;
$aData['USR_ID'] = (empty($user)) ? 0 : $user->getUsrId(); $newData['USR_ID'] = (empty($user)) ? 0 : $user->getUsrId();
$oAppDelegation->update($aData); $appDelegation->update($newData);
$oAppThread = new AppThread(); $appThread = new AppThread();
$oAppThread->update( $appThread->update(
array( [
'APP_UID' => $sApplicationUID, 'APP_UID' => $appUid,
'APP_THREAD_INDEX' => $aFieldsDel['DEL_THREAD'], 'APP_THREAD_INDEX' => $fieldsDel['DEL_THREAD'],
'DEL_INDEX' => $iIndex) 'DEL_INDEX' => $newDelIndex
]
); );
//Save in APP_DELAY //Save in APP_DELAY
$oApplication = new Application(); $application = new Application();
$aFields = $oApplication->Load($sApplicationUID); $dataFields = $application->Load($appUid);
$aData['PRO_UID'] = $aFieldsDel['PRO_UID']; $newData['PRO_UID'] = $fieldsDel['PRO_UID'];
$aData['APP_UID'] = $sApplicationUID; $newData['APP_UID'] = $appUid;
$aData['APP_THREAD_INDEX'] = $aFieldsDel['DEL_THREAD']; $newData['APP_THREAD_INDEX'] = $fieldsDel['DEL_THREAD'];
$aData['APP_DEL_INDEX'] = $iDelegation; $newData['APP_DEL_INDEX'] = $delIndex;
$aData['APP_TYPE'] = ($sType != '' ? $sType : 'REASSIGN'); $newData['APP_TYPE'] = ($type != '' ? $type : 'REASSIGN');
$aData['APP_STATUS'] = $aFields['APP_STATUS']; $newData['APP_STATUS'] = $dataFields['APP_STATUS'];
$aData['APP_DELEGATION_USER'] = $sUserUID; $newData['APP_DELEGATION_USER'] = $currentUserUid;
$aData['APP_ENABLE_ACTION_USER'] = $sUserUID; $newData['APP_ENABLE_ACTION_USER'] = $currentUserUid;
$aData['APP_ENABLE_ACTION_DATE'] = date('Y-m-d H:i:s'); $newData['APP_ENABLE_ACTION_DATE'] = date('Y-m-d H:i:s');
$aData['APP_NUMBER'] = $aFieldsDel['APP_NUMBER']; $newData['APP_NUMBER'] = $fieldsDel['APP_NUMBER'];
$oAppDelay = new AppDelay(); $appDelay = new AppDelay();
$oAppDelay->create($aData); $appDelay->create($newData);
//update searchindex //update searchindex
if ($this->appSolr != null) { if ($this->appSolr != null) {
$this->appSolr->updateApplicationSearchIndex($sApplicationUID); $this->appSolr->updateApplicationSearchIndex($appUid);
} }
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/
$participated = new ListParticipatedLast(); $participated = new ListParticipatedLast();
$participated->remove($aData['APP_UID'], $newUserUID, $iDelegation); $participated->remove($newData['APP_UID'], $newUserUid, $delIndex);
$aFieldsDel = array_merge($aData, $aFieldsDel); $fieldsDel = array_merge($newData, $fieldsDel);
$aFieldsDel['USR_UID'] = $newUserUID; $fieldsDel['USR_UID'] = $newUserUid;
$aFieldsDel['DEL_INDEX'] = $newDelIndex; $fieldsDel['DEL_INDEX'] = $newDelIndex;
$inbox = new ListInbox(); $inbox = new ListInbox();
$inbox->newRow($aFieldsDel, $sUserUID); $inbox->newRow($fieldsDel, $currentUserUid);
//Update - WHERE //Update - WHERE
$criteriaWhere = new Criteria("workflow"); $criteriaWhere = new Criteria("workflow");
$criteriaWhere->add(ListInboxPeer::APP_UID, $aFieldsDel["APP_UID"], Criteria::EQUAL); $criteriaWhere->add(ListInboxPeer::APP_UID, $fieldsDel["APP_UID"], Criteria::EQUAL);
$criteriaWhere->add(ListInboxPeer::USR_UID, $aFieldsDel['USR_UID'], Criteria::EQUAL); $criteriaWhere->add(ListInboxPeer::USR_UID, $fieldsDel['USR_UID'], Criteria::EQUAL);
$criteriaWhere->add(ListInboxPeer::DEL_INDEX, $aFieldsDel['DEL_INDEX'], Criteria::EQUAL); $criteriaWhere->add(ListInboxPeer::DEL_INDEX, $fieldsDel['DEL_INDEX'], Criteria::EQUAL);
//Update - SET //Update - SET
$criteriaSet = new Criteria("workflow"); $criteriaSet = new Criteria("workflow");
$criteriaSet->add(ListInboxPeer::DEL_INDEX, $aData['DEL_INDEX']); $criteriaSet->add(ListInboxPeer::DEL_INDEX, $newData['DEL_INDEX']);
BasePeer::doUpdate($criteriaWhere, $criteriaSet, Propel::getConnection("workflow")); BasePeer::doUpdate($criteriaWhere, $criteriaSet, Propel::getConnection("workflow"));
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/
$this->getExecuteTriggerProcess($sApplicationUID, 'REASSIGNED'); $this->getExecuteTriggerProcess($appUid, 'REASSIGNED');
//Delete record of the table LIST_UNASSIGNED //Delete record of the table LIST_UNASSIGNED
$unassigned = new ListUnassigned(); $unassigned = new ListUnassigned();
$unassigned->remove($sApplicationUID, $iDelegation); $unassigned->remove($appUid, $delIndex);
return true; return true;
} }