PMCORE-1332

This commit is contained in:
Luciana Nuñez
2022-11-01 12:17:57 -04:00
parent 26a122b5e4
commit 122b9e5e19
4 changed files with 15 additions and 14 deletions

View File

@@ -3332,13 +3332,13 @@ class DelegationTest extends TestCase
//Create task
$task = Task::factory()->create();
//Create a delegation
Delegation::factory()->create([
$delegation = Delegation::factory()->create([
'DEL_THREAD_STATUS' => 'OPEN',
'DEL_FINISH_DATE' => null,
'APP_NUMBER' => $application->APP_NUMBER,
'TAS_UID' => $task->TAS_UID,
]);
$result = Delegation::getOpenThreads($application->APP_NUMBER, $task->TAS_UID);
$result = Delegation::getOpenThread($application->APP_NUMBER, $delegation->DEL_INDEX);
$this->assertEquals($application->APP_NUMBER, $result['APP_NUMBER']);
}
@@ -3357,12 +3357,12 @@ class DelegationTest extends TestCase
//Create task
$task = Task::factory()->create();
//Create a delegation
Delegation::factory()->create([
$delegation = Delegation::factory()->create([
'DEL_THREAD_STATUS' => 'CLOSED',
'APP_NUMBER' => $application->APP_NUMBER,
'TAS_UID' => $task->TAS_UID,
]);
$result = Delegation::getOpenThreads($application->APP_NUMBER, $task->TAS_UID);
$result = Delegation::getOpenThread($application->APP_NUMBER, $delegation->DEL_INDEX);
$this->assertEmpty($result);
}
@@ -3383,12 +3383,12 @@ class DelegationTest extends TestCase
//Create task
$task = Task::factory()->create();
//Create a delegation
Delegation::factory()->create([
$delegation = Delegation::factory()->create([
'DEL_THREAD_STATUS' => 'CLOSED',
'APP_NUMBER' => $application->APP_NUMBER,
'TAS_UID' => $task->TAS_UID,
]);
$result = Delegation::getOpenThreads($application->APP_NUMBER, $task->TAS_UID);
$result = Delegation::getOpenThread($application->APP_NUMBER, $delegation->DEL_INDEX);
$this->assertEmpty($result);
}

View File

@@ -374,6 +374,7 @@ function getReassignList()
$caseReaderFields[] = ['name' => 'APP_NUMBER'];
$caseReaderFields[] = ['name' => 'APP_TITLE'];
$caseReaderFields[] = ['name' => 'APP_UID'];
$caseReaderFields[] = ['name' => 'DEL_INDEX'];
$caseReaderFields[] = ['name' => 'USR_UID'];
$caseReaderFields[] = ['name' => 'APP_TAS_TITLE'];
$caseReaderFields[] = ['name' => 'APP_PRO_TITLE'];

View File

@@ -26,7 +26,7 @@ if (empty($dataPost)) {
foreach ($dataPost as $data) {
// It was supposed will return only one thread related to the task
// todo: implement the reassign case for multi instance task
$openThreads = Delegation::getOpenThreads($data->APP_NUMBER, $data->TAS_UID);
$openThreads = Delegation::getOpenThread($data->APP_NUMBER, $data->DEL_INDEX);
if (!empty($openThreads)) {
// Get the user information assigned in the index
$currentUsrUid = Delegation::getCurrentUser($openThreads['APP_NUMBER'], $openThreads['DEL_INDEX']);

View File

@@ -1847,25 +1847,25 @@ class Delegation extends Model
* Return the open thread related to the task
*
* @param int $appNumber, Case number
* @param string $tasUid, The task uid
* @param int $delIndex
*
* @return array
*/
public static function getOpenThreads(int $appNumber, string $tasUid)
public static function getOpenThread(int $appNumber, int $delIndex)
{
$query = Delegation::query()->select();
$query->where('DEL_THREAD_STATUS', 'OPEN');
$query->where('DEL_FINISH_DATE', null);
$query->where('APP_NUMBER', $appNumber);
$query->where('TAS_UID', $tasUid);
$query->where('DEL_INDEX', $delIndex);
$results = $query->get();
$arrayOpenThreads = [];
$results->each(function ($item, $key) use (&$arrayOpenThreads) {
$arrayOpenThreads = $item->toArray();
$arrayOpenThread = [];
$results->each(function ($item, $key) use (&$arrayOpenThread) {
$arrayOpenThread = $item->toArray();
});
return $arrayOpenThreads;
return $arrayOpenThread;
}
/**