PMCORE-4088

This commit is contained in:
Luciana Nuñez
2022-12-07 11:48:46 -04:00
parent 6e80a9e2f5
commit 3f88a7d75d
2 changed files with 31 additions and 4 deletions

View File

@@ -934,7 +934,7 @@ class Cases
* @param string $usrUid Unique id of User * @param string $usrUid Unique id of User
* @param int $delIndex * @param int $delIndex
* @param string $userSource Unique id of User Source * @param string $userSource Unique id of User Source
* @param string $userTarget $userUidTarget id of User Target * @param string $userTarget id of User Target
* @param string $reason * @param string $reason
* @param boolean $sendMail * @param boolean $sendMail
* *
@@ -967,6 +967,18 @@ class Cases
$cases = new BmCases(); $cases = new BmCases();
$response = $cases->addNote($appUid, $usrUid, $noteContent, $sendMail); $response = $cases->addNote($appUid, $usrUid, $noteContent, $sendMail);
} }
// Log
$message = 'Reassign case';
$context = $data = [
"appUid" => $appUid,
"usrUidSupervisor" => $usrUid,
"userSource" => $userSource,
"userTarget" => $userTarget,
"reason" => $reason,
"delIndex" => $delIndex
];
Log::channel(':ReassignCase')->info($message, Bootstrap::context($context));
} catch (Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
@@ -1143,13 +1155,15 @@ class Cases
* @param string $appUid * @param string $appUid
* @param integer $index * @param integer $index
* @param string $userUid * @param string $userUid
* @param string $action
* @param string $reason
* *
* @return void * @return void
* @throws Exception * @throws Exception
* *
* @access public * @access public
*/ */
public function putClaimCase($appUid, $index, $userUid) public function putClaimCase($appUid, $index, $userUid, $action, $reason = '')
{ {
// Validate the parameters // Validate the parameters
Validator::isString($appUid, '$appUid'); Validator::isString($appUid, '$appUid');
@@ -1176,6 +1190,19 @@ class Cases
} else { } else {
throw new Exception(G::LoadTranslation("ID_CASE_USER_INVALID_CLAIM_CASE", [$userUid])); throw new Exception(G::LoadTranslation("ID_CASE_USER_INVALID_CLAIM_CASE", [$userUid]));
} }
$usrUidSupervisor = (Server::getUserId() === $userUid) ? '' : Server::getUserId();
// Log
$message = $action . ' case';
$context = $data = [
"appUid" => $appUid,
"usrUidSupervisor" => $usrUidSupervisor,
"userTarget" => $userUid,
"reason" => $reason,
"delIndex" => $index
];
Log::channel(':' . $action . 'Case')->info($message, Bootstrap::context($context));
} }
/** /**

View File

@@ -1031,7 +1031,7 @@ class Cases extends Api
try { try {
$userUid = $this->getUserId(); $userUid = $this->getUserId();
$cases = new BmCases(); $cases = new BmCases();
$cases->putClaimCase($appUid, $index, $userUid); $cases->putClaimCase($appUid, $index, $userUid, 'Claim');
} catch (Exception $e) { } catch (Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
} }
@@ -1081,7 +1081,7 @@ class Cases extends Api
{ {
try { try {
$cases = new BmCases(); $cases = new BmCases();
$cases->putClaimCase($appUid, $index, $usrUid); $cases->putClaimCase($appUid, $index, $usrUid, 'Assign', $reason);
/** Add the note */ /** Add the note */
if (!empty($reason)) { if (!empty($reason)) {