Merged in bugfix/PMC-24 (pull request #7062)

PMC-24

Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
Paula Quispe
2019-09-06 12:51:53 +00:00
committed by Julio Cesar Laura Avendaño
4 changed files with 186 additions and 83 deletions

View File

@@ -1,4 +1,5 @@
<?php
namespace Tests\unit\workflow\src\ProcessMaker\Model;
use Faker\Factory;
@@ -18,11 +19,18 @@ use ProcessMaker\Model\TaskUser;
use ProcessMaker\Model\User;
use Tests\TestCase;
/**
* Class DelegationTest
*
* @coversDefaultClass \ProcessMaker\Model\Delegation
*/
class DelegationTest extends TestCase
{
use DatabaseTransactions;
/**
* This checks to make sure pagination is working properly
*
* @test
*/
public function it_should_return_pages_of_data()
@@ -43,6 +51,7 @@ class DelegationTest extends TestCase
/**
* This checks to make sure pagination is working properly
*
* @test
*/
public function it_should_return_pages_of_data_unassigned()
@@ -66,6 +75,7 @@ class DelegationTest extends TestCase
/**
* This checks to make sure filter by process is working properly
*
* @test
*/
public function it_should_return_process_of_data()
@@ -89,6 +99,7 @@ class DelegationTest extends TestCase
/**
* This checks to make sure filter by status is working properly
* Review status filter by a specific status, such as Draft
*
* @test
*/
public function it_should_return_status_draft_of_data()
@@ -96,7 +107,6 @@ class DelegationTest extends TestCase
factory(User::class, 100)->create();
factory(Process::class)->create();
$application = factory(Application::class)->create([
'APP_NUMBER' => 2001,
'APP_STATUS_ID' => 1,
'APP_STATUS' => 'DRAFT'
]);
@@ -118,6 +128,7 @@ class DelegationTest extends TestCase
/**
* This checks to make sure filter by status is working properly
* Review status filter by a specific status, such as To Do
*
* @test
*/
public function it_should_return_status_todo_of_data()
@@ -125,7 +136,6 @@ class DelegationTest extends TestCase
factory(User::class, 100)->create();
factory(Process::class)->create();
$application = factory(Application::class)->create([
'APP_NUMBER' => 2001,
'APP_STATUS_ID' => 2,
'APP_STATUS' => 'TO_DO'
]);
@@ -147,6 +157,7 @@ class DelegationTest extends TestCase
/**
* This checks to make sure filter by status is working properly
* Review status filter by a specific status, such as Completed
*
* @test
*/
public function it_should_return_status_completed_of_data()
@@ -154,7 +165,6 @@ class DelegationTest extends TestCase
factory(User::class, 100)->create();
factory(Process::class)->create();
$application = factory(Application::class)->create([
'APP_NUMBER' => 2001,
'APP_STATUS_ID' => 3,
'APP_STATUS' => 'COMPLETED',
]);
@@ -178,6 +188,7 @@ class DelegationTest extends TestCase
/**
* This checks to make sure filter by status is working properly
* Review status filter by a specific status, such as Cancelled
*
* @test
*/
public function it_should_return_status_cancelled_of_data()
@@ -185,7 +196,6 @@ class DelegationTest extends TestCase
factory(User::class, 100)->create();
factory(Process::class)->create();
$application = factory(Application::class)->create([
'APP_NUMBER' => 2001,
'APP_STATUS_ID' => 4,
'APP_STATUS' => 'CANCELLED'
]);
@@ -208,6 +218,7 @@ class DelegationTest extends TestCase
/**
* This ensures searching for a valid user works
*
* @test
*/
public function it_should_return_one_result_for_specified_user()
@@ -231,6 +242,7 @@ class DelegationTest extends TestCase
/**
* This ensures searching by case number and review the order
*
* @test
*/
public function it_should_search_by_case_id_and_order_of_data()
@@ -306,6 +318,7 @@ class DelegationTest extends TestCase
/**
* This ensures searching by case title and review the page
*
* @test
*/
public function it_should_search_by_case_title_and_pages_of_data_app_number_matches_case_title()
@@ -388,6 +401,7 @@ class DelegationTest extends TestCase
/**
* This ensures searching by task title and review the page
*
* @test
*/
public function it_should_search_by_task_title_and_pages_of_data()
@@ -395,14 +409,12 @@ class DelegationTest extends TestCase
factory(User::class, 100)->create();
factory(Process::class)->create();
$task = factory(Task::class)->create([
'TAS_ID' => 1,
'TAS_TITLE' => 'Request task'
]);
factory(Delegation::class, 5)->create([
'TAS_ID' => $task->TAS_ID
]);
$task = factory(Task::class)->create([
'TAS_ID' => 2,
'TAS_TITLE' => 'Account task'
]);
factory(Delegation::class, 5)->create([
@@ -436,6 +448,7 @@ class DelegationTest extends TestCase
/**
* This ensures searching by case title and review the page
*
* @test
*/
public function it_should_search_by_case_title_and_pages_of_data_app_number_no_matches_case_title()
@@ -511,6 +524,7 @@ class DelegationTest extends TestCase
/**
* This ensures ordering ascending and descending works by case number APP_NUMBER
*
* @test
*/
public function it_should_sort_by_case_id()
@@ -543,6 +557,7 @@ class DelegationTest extends TestCase
/**
* This ensures ordering ascending and descending works by case title APP_TITLE
*
* @test
*/
public function it_should_sort_by_case_title()
@@ -550,14 +565,12 @@ class DelegationTest extends TestCase
factory(User::class, 100)->create();
factory(Process::class)->create();
$application = factory(Application::class)->create([
'APP_NUMBER' => 2001,
'APP_TITLE' => 'Request by Thomas'
]);
factory(Delegation::class)->create([
'APP_NUMBER' => $application->APP_NUMBER
]);
$application = factory(Application::class)->create([
'APP_NUMBER' => 30002,
'APP_TITLE' => 'Request by Ariel'
]);
factory(Delegation::class)->create([
@@ -577,6 +590,7 @@ class DelegationTest extends TestCase
/**
* This ensures ordering ascending and descending works by case title APP_PRO_TITLE
*
* @test
*/
public function it_should_sort_by_process()
@@ -620,6 +634,7 @@ class DelegationTest extends TestCase
/**
* This ensures ordering ascending and descending works by task title APP_TAS_TITLE
*
* @test
*/
public function it_should_sort_by_task_title()
@@ -627,14 +642,12 @@ class DelegationTest extends TestCase
factory(User::class, 100)->create();
factory(Process::class)->create();
$task = factory(Task::class)->create([
'TAS_ID' => 1000,
'TAS_TITLE' => 'Initiate Request'
]);
factory(Delegation::class)->create([
'TAS_ID' => $task->TAS_ID
]);
$task = factory(Task::class)->create([
'TAS_ID' => 4000,
'TAS_TITLE' => 'Waiting for AP Manager Validation'
]);
factory(Delegation::class)->create([
@@ -654,6 +667,7 @@ class DelegationTest extends TestCase
/**
* This ensures ordering ascending and descending works by current user
*
* @test
*/
public function it_should_sort_by_user()
@@ -694,11 +708,12 @@ class DelegationTest extends TestCase
/**
* This ensures ordering ordering ascending and descending works by last modified APP_UPDATE_DATE
*
* @test
*/
public function it_should_sort_by_last_modified()
{
factory(User::class,100)->create();
factory(User::class, 100)->create();
factory(Process::class)->create();
$application = factory(Application::class)->create([
'APP_UPDATE_DATE' => '2019-01-02 00:00:00'
@@ -746,11 +761,12 @@ class DelegationTest extends TestCase
/**
* This ensures ordering ascending and descending works by due date DEL_TASK_DUE_DATE
*
* @test
*/
public function it_should_sort_by_due_date()
{
factory(User::class,100)->create();
factory(User::class, 100)->create();
factory(Process::class)->create();
factory(Delegation::class, 10)->create([
'DEL_TASK_DUE_DATE' => '2019-01-02 00:00:00'
@@ -789,11 +805,12 @@ class DelegationTest extends TestCase
/**
* This ensures ordering ascending and descending works by status APP_STATUS
*
* @test
*/
public function it_should_sort_by_status()
{
factory(User::class,100)->create();
factory(User::class, 100)->create();
factory(Process::class)->create();
$application = factory(Application::class)->create([
'APP_STATUS' => 'DRAFT'
@@ -842,6 +859,7 @@ class DelegationTest extends TestCase
/**
* This checks to make sure filter by category is working properly
*
* @test
*/
public function it_should_return_data_filtered_by_process_category()
@@ -881,6 +899,7 @@ class DelegationTest extends TestCase
/**
* This ensure the result is right when you search between two given dates
*
* @test
*/
public function it_should_return_right_data_between_two_dates()
@@ -903,6 +922,7 @@ class DelegationTest extends TestCase
/**
* This ensure the result is right when you search from a given date
*
* @test
*/
public function it_should_return_right_data_when_you_send_only_dateFrom_parameter()
@@ -924,6 +944,7 @@ class DelegationTest extends TestCase
/**
* This ensure the result is right when you search to a given date
*
* @test
*/
public function it_should_return_right_data_when_you_send_only_dateTo_parameter()
@@ -945,6 +966,7 @@ class DelegationTest extends TestCase
/**
* This ensures return the correct data by sequential
*
* @test
*/
public function it_should_return_by_sequential_tasks_pages_of_data()
@@ -993,6 +1015,7 @@ class DelegationTest extends TestCase
/**
* This ensures return the correct data by parallel task all threads CLOSED
*
* @test
*/
public function it_should_return_by_parallel_tasks_threads_closed()
@@ -1026,6 +1049,7 @@ class DelegationTest extends TestCase
/**
* This ensures return the correct data by parallel task all threads OPEN
*
* @test
*/
public function it_should_return_by_parallel_tasks_threads_open()
@@ -1045,6 +1069,7 @@ class DelegationTest extends TestCase
/**
* Review when the status is empty
*
* @test
*/
public function it_should_return_status_empty()
@@ -1064,6 +1089,7 @@ class DelegationTest extends TestCase
/**
* Review when filter when the process and category does not have a relation
*
* @test
*/
public function it_should_return_process_and_category_does_not_have_a_relation()
@@ -1087,15 +1113,18 @@ class DelegationTest extends TestCase
'PRO_ID' => $processNoCategory->id
]);
//Search the cases related to the category and process does not have relation
$results = Delegation::search(null, 0, 25, null, $processWithCat->id, null, null, null, $category[1]->CATEGORY_UID);
$results = Delegation::search(null, 0, 25, null, $processWithCat->id, null, null, null,
$category[1]->CATEGORY_UID);
$this->assertCount(0, $results['data']);
//Search the cases related to the category and process does not have relation
$results = Delegation::search(null, 0, 25, null, $processNoCategory->id, null, null, null, $category[0]->CATEGORY_UID);
$results = Delegation::search(null, 0, 25, null, $processNoCategory->id, null, null, null,
$category[0]->CATEGORY_UID);
$this->assertCount(0, $results['data']);
}
/**
* Review when filter when the process and category does have a relation
*
* @test
*/
public function it_should_return_process_and_category_does_have_a_relation()
@@ -1119,7 +1148,8 @@ class DelegationTest extends TestCase
'PRO_ID' => $process->id,
]);
//Search the cases when the category and process does have relation with a category
$results = Delegation::search(null, 0, 25, null, $processWithCat->id, null, null, null, $category->CATEGORY_UID);
$results = Delegation::search(null, 0, 25, null, $processWithCat->id, null, null, null,
$category->CATEGORY_UID);
$this->assertCount(1, $results['data']);
//Search the cases when the category and process does have relation with category empty
$results = Delegation::search(null, 0, 25, null, $process->id, null, null, null, '');
@@ -1128,6 +1158,7 @@ class DelegationTest extends TestCase
/**
* Check if return participation information
*
* @test
*/
public function it_should_return_participation_info()
@@ -1158,6 +1189,7 @@ class DelegationTest extends TestCase
/**
* Check if return an empty participation information
*
* @test
*/
public function it_should_return_empty_participation_info()
@@ -1171,7 +1203,8 @@ class DelegationTest extends TestCase
/**
* This checks the counters is working properly in self-service user assigned
* @covers Delegation::countSelfService
*
* @covers ::countSelfService()
* @test
*/
public function it_should_count_cases_by_user_with_self_service_user_assigned()
@@ -1205,9 +1238,10 @@ class DelegationTest extends TestCase
}
/**
* This checks the counters is working properly in self-service-value-based when the variable has a value related with the USR_UID
* When the value assigned in the variable @@ARRAY_OF_USERS = [USR_UID]
* @covers Delegation::countSelfService
* This checks the counters is working properly in self-service-value-based when the variable has a value related
* with the USR_UID When the value assigned in the variable @@ARRAY_OF_USERS = [USR_UID]
*
* @covers ::countSelfService()
* @test
*/
public function it_should_count_cases_by_user_with_self_service_value_based_usr_uid()
@@ -1251,7 +1285,8 @@ class DelegationTest extends TestCase
/**
* This checks the counters is working properly in self-service and self-service value based
* @covers Delegation::countSelfService
*
* @covers ::countSelfService()
* @test
*/
public function it_should_count_cases_by_user_with_self_service_mixed_with_self_service_value_based()
@@ -1314,7 +1349,8 @@ class DelegationTest extends TestCase
/**
* This checks the counters is working properly in self-service group assigned
* @covers Delegation::countSelfService
*
* @covers ::countSelfService()
* @test
*/
public function it_should_count_cases_by_user_with_self_service_group_assigned()
@@ -1356,9 +1392,10 @@ class DelegationTest extends TestCase
}
/**
* This checks the counters is working properly in self-service-value-based when the variable has a value related with the GRP_UID
* When the value assigned in the variable @@ARRAY_OF_USERS = [GRP_UID]
* @covers Delegation::countSelfService
* This checks the counters is working properly in self-service-value-based when the variable has a value related
* with the GRP_UID When the value assigned in the variable @@ARRAY_OF_USERS = [GRP_UID]
*
* @covers ::countSelfService()
* @test
*/
public function it_should_count_cases_by_user_with_self_service_value_based_grp_uid()
@@ -1415,7 +1452,8 @@ class DelegationTest extends TestCase
/**
* This checks the counters is working properly in self-service user and group assigned in parallel task
* @covers Delegation::countSelfService
*
* @covers ::countSelfService()
* @test
*/
public function it_should_count_cases_by_user_with_self_service_user_and_group_assigned_parallel_task()
@@ -1514,9 +1552,10 @@ class DelegationTest extends TestCase
}
/**
* This checks the counters is working properly in self-service-value-based with GRP_UID and USR_UID in parallel task
* When the value assigned in the variable @@ARRAY_OF_USERS = [GRP_UID, USR_UID]
* @covers Delegation::countSelfService
* This checks the counters is working properly in self-service-value-based with GRP_UID and USR_UID in parallel
* task When the value assigned in the variable @@ARRAY_OF_USERS = [GRP_UID, USR_UID]
*
* @covers ::countSelfService()
* @test
*/
public function it_should_count_cases_by_user_with_self_service_value_based_usr_uid_and_grp_uid()
@@ -1585,7 +1624,7 @@ class DelegationTest extends TestCase
/**
* This check if return the USR_UID assigned in the thread OPEN
*
* @covers Delegation::getCurrentUser
* @covers ::getCurrentUser()
* @test
*/
public function it_should_return_current_user_for_thread_open()
@@ -1618,7 +1657,7 @@ class DelegationTest extends TestCase
/**
* This check if return the USR_UID assigned in the thread CLOSED
*
* @covers Delegation::getCurrentUser
* @covers ::getCurrentUser()
* @test
*/
public function it_should_return_current_user_for_thread_closed()
@@ -1651,7 +1690,7 @@ class DelegationTest extends TestCase
/**
* This check if return empty when the data does not exits
*
* @covers Delegation::getCurrentUser
* @covers ::getCurrentUser()
* @test
*/
public function it_should_return_empty_when_row_does_not_exist()
@@ -1687,7 +1726,7 @@ class DelegationTest extends TestCase
/**
* This checks if return the open thread
*
* @covers Delegation::getOpenThreads
* @covers ::getOpenThreads()
* @test
*/
public function it_should_return_thread_open()
@@ -1714,7 +1753,7 @@ class DelegationTest extends TestCase
/**
* This checks if return empty when the thread is CLOSED
*
* @covers Delegation::getOpenThreads
* @covers ::getOpenThreads()
* @test
*/
public function it_should_return_empty_when_thread_is_closed()
@@ -1738,7 +1777,7 @@ class DelegationTest extends TestCase
/**
* This checks if return empty when the data is not null
*
* @covers Delegation::getOpenThreads
* @covers ::getOpenThreads()
* @test
*/
public function it_should_return_empty_when_thread_finish_date_is_not_null()
@@ -1760,4 +1799,49 @@ class DelegationTest extends TestCase
$result = Delegation::getOpenThreads($application->APP_NUMBER, $task->TAS_UID);
$this->assertEmpty($result);
}
/**
* This checks if return the participation when the user does have participation
*
* @covers \ProcessMaker\Model\Delegation::participation()
* @test
*/
public function it_when_the_user_does_have_participation()
{
factory(Process::class)->create();
//Create user
$user = factory(User::class)->create();
$application = factory(Application::class)->create();
//Create a delegation
factory(Delegation::class)->create([
'APP_NUMBER' => $application->APP_NUMBER,
'APP_UID' => $application->APP_UID,
'USR_ID' => $user->USR_ID,
'USR_UID' => $user->USR_UID
]);
$result = Delegation::participation($application->APP_UID, $user->USR_UID);
$this->assertTrue($result);
}
/**
* This checks if return the participation of the user when the user does not have participation
*
* @covers \ProcessMaker\Model\Delegation::participation()
* @test
*/
public function it_when_the_user_does_not_have_participation()
{
factory(Process::class)->create();
//Create user
$user = factory(User::class)->create();
$application = factory(Application::class)->create();
//Create a delegation
factory(Delegation::class)->create([
'APP_NUMBER' => $application->APP_NUMBER,
'APP_UID' => $application->APP_UID
]);
$result = Delegation::participation($application->APP_UID, $user->USR_UID);
$this->assertFalse($result);
}
}

View File

@@ -1,49 +1,56 @@
<?php
/**
* cases_Resume.php
*
* Shows a brief information about the case
*
* @link https://wiki.processmaker.com/3.2/Cases/Cases#Participated
*/
use ProcessMaker\BusinessModel\Cases as BmCases;
use ProcessMaker\BusinessModel\Task as BusinessModelTask;
use ProcessMaker\Util\DateTime;
/* Permissions */
/** Permissions */
switch ($RBAC->userCanAccess('PM_CASES')) {
case - 2:
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die();
break;
case - 1:
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die();
break;
}
/* GET , POST & $_SESSION Vars */
/* Menues */
/** Menu's */
$_SESSION['bNoShowSteps'] = true;
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'caseOptions';
$G_ID_MENU_SELECTED = 'CASES';
$G_ID_SUB_MENU_SELECTED = '_';
/* Prepare page before to show */
$oCase = new Cases();
//Check the authorization
$objCase = new \ProcessMaker\BusinessModel\Cases();
$aUserCanAccess = $objCase->userAuthorization(
/** Prepare page before to show */
// Check the authorization
$objCase = new BmCases();
$userCanAccess = $objCase->userAuthorization(
$_SESSION['USER_LOGGED'],
$_SESSION['PROCESS'],
$_GET['APP_UID'],
array('PM_ALLCASES'),
array('SUMMARY_FORM' => 'VIEW')
['PM_ALLCASES'],
['SUMMARY_FORM' => 'VIEW']
);
$cases = new Cases();
if (isset($_SESSION['ACTION']) && ($_SESSION['ACTION'] == 'jump')) {
$Fields = $oCase->loadCase($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['ACTION']);
$Fields = $cases->loadCase($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['ACTION']);
$process = new Process();
$processData = $process->load($Fields['PRO_UID']);
if (isset($processData['PRO_DYNAFORMS']['PROCESS']) && $processData['PRO_DYNAFORMS']['PROCESS'] != '' &&
$aUserCanAccess['objectPermissions']['SUMMARY_FORM']
$userCanAccess['objectPermissions']['SUMMARY_FORM']
) {
$_REQUEST['APP_UID'] = $Fields['APP_UID'];
$_REQUEST['DEL_INDEX'] = $Fields['DEL_INDEX'];
@@ -52,35 +59,30 @@ if (isset($_SESSION['ACTION']) && ($_SESSION['ACTION'] == 'jump')) {
exit();
}
} else {
$Fields = $oCase->loadCase($_SESSION['APPLICATION'], $_SESSION['INDEX']);
$Fields = $cases->loadCase($_SESSION['APPLICATION'], $_SESSION['INDEX']);
}
if (!$aUserCanAccess['participated'] && !$aUserCanAccess['supervisor'] && !$aUserCanAccess['rolesPermissions']['PM_ALLCASES'] && !$aUserCanAccess['objectPermissions']['SUMMARY_FORM']) {
$aMessage['MESSAGE'] = G::LoadTranslation('ID_NO_PERMISSION_NO_PARTICIPATED');
if (
!$userCanAccess['participated'] &&
!$userCanAccess['supervisor'] &&
!$userCanAccess['rolesPermissions']['PM_ALLCASES'] &&
!$userCanAccess['objectPermissions']['SUMMARY_FORM']
) {
$message = [];
$message['MESSAGE'] = G::LoadTranslation('ID_NO_PERMISSION_NO_PARTICIPATED');
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage);
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $message);
G::RenderPage('publishBlank', 'blank');
die();
}
if (isset($aRow['APP_TYPE'])) {
switch ($aRow['APP_TYPE']) {
case 'PAUSE':
$Fields['STATUS'] = ucfirst(strtolower(G::LoadTranslation('ID_PAUSED')));
break;
case 'CANCEL':
$Fields['STATUS'] = ucfirst(strtolower(G::LoadTranslation('ID_CANCELLED')));
break;
}
}
$actions = 'false';
if (isset($_GET['action']) && $_GET['action'] == 'paused') {
$actions = 'true';
}
/* Render page */
/** Render page */
$oHeadPublisher = headPublisher::getSingleton();
$oHeadPublisher->addScriptCode("
if (typeof parent != 'undefined') {
if (parent.showCaseNavigatorPanel) {
@@ -103,11 +105,11 @@ $oHeadPublisher->addScriptCode('
require_once 'classes/model/Process.php';
$objProc = new Process();
$aProc = $objProc->load($Fields['PRO_UID']);
$Fields['PRO_TITLE'] = $aProc['PRO_TITLE'];
$processFields = $objProc->load($Fields['PRO_UID']);
$Fields['PRO_TITLE'] = $processFields['PRO_TITLE'];
$objTask = new Task();
if (!isset($Fields['TAS_UID']) || $Fields['TAS_UID'] == '') {
if (!isset($Fields['TAS_UID']) || empty($Fields['TAS_UID'])) {
$Fields['TAS_UID'] = $Fields['APP_DATA']['TASK'];
}
@@ -118,12 +120,12 @@ $tasksInParallel = array_filter($tasksInParallel, function ($value) {
$nTasksInParallel = count($tasksInParallel);
if ($nTasksInParallel > 1) {
$aTask = $objTask->load($tasksInParallel[$nTasksInParallel - 1]);
$taskInfo = $objTask->load($tasksInParallel[$nTasksInParallel - 1]);
} else {
$aTask = $objTask->load($Fields['TAS_UID']);
$taskInfo = $objTask->load($Fields['TAS_UID']);
}
$Fields['TAS_TITLE'] = $aTask['TAS_TITLE'];
$Fields['TAS_TITLE'] = $taskInfo['TAS_TITLE'];
$Fields = DateTime::convertUtcToTimeZone($Fields);
$objUser = new Users();
@@ -153,9 +155,9 @@ if ($Fields['APP_STATUS'] != 'COMPLETED') {
}
}
$FieldsPar['DEL_DELEGATE_DATE'] = DateTime::convertUtcToTimeZone($row['DEL_DELEGATE_DATE']);
$FieldsPar['DEL_INIT_DATE'] = DateTime::convertUtcToTimeZone($row['DEL_INIT_DATE']);
$FieldsPar['DEL_INIT_DATE'] = DateTime::convertUtcToTimeZone($row['DEL_INIT_DATE']);
$FieldsPar['DEL_TASK_DUE_DATE'] = DateTime::convertUtcToTimeZone($row['DEL_TASK_DUE_DATE']);
$FieldsPar['DEL_FINISH_DATE'] = DateTime::convertUtcToTimeZone($row['DEL_FINISH_DATE']);
$FieldsPar['DEL_FINISH_DATE'] = DateTime::convertUtcToTimeZone($row['DEL_FINISH_DATE']);
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'cases/cases_Resume_Current_Task.xml', '', $FieldsPar);
}
}

View File

@@ -11,6 +11,7 @@ use AppDelegationPeer;
use AppDocument;
use AppDocumentPeer;
use AppHistoryPeer;
use Application;
use ApplicationPeer;
use Applications;
use AppNotesPeer;
@@ -45,7 +46,6 @@ use ProcessMaker\Services\OAuth2\Server;
use ProcessMaker\Util\DateTime as UtilDateTime;
use ProcessMaker\Validation\ExceptionRestApi;
use ProcessMaker\Validation\Validator as FileValidator;
use ProcessPeer;
use ProcessUser;
use ProcessUserPeer;
@@ -3317,6 +3317,7 @@ class Cases
* @param array $objectPermissions, the permissions that we need to review
* @param boolean $objectSupervisor, if we need to get all the objects supervisor
* @param string $tasUid
*
* @return array
*/
public function userAuthorization(
@@ -3330,23 +3331,21 @@ class Cases
) {
$arrayAccess = [];
//User has participated
$participated = new ListParticipatedLast();
$listParticipated = $participated->loadList($usrUid, [], null, $appUid);
$arrayAccess['participated'] = (count($listParticipated) == 0) ? false : true;
// User has participated
$arrayAccess['participated'] = Delegation::participation($appUid, $usrUid);
//User is supervisor
// User is supervisor
$supervisor = new BmProcessSupervisor();
$isSupervisor = $supervisor->isUserProcessSupervisor($proUid, $usrUid);
$arrayAccess['supervisor'] = ($isSupervisor) ? true : false;
//If the user is supervisor we will to return the object assigned
// If the user is supervisor we will to return the object assigned
if ($isSupervisor && $objectSupervisor) {
$ps = new BmProcessSupervisor();
$arrayAccess['objectSupervisor'] = $ps->getObjectSupervisor($proUid);
}
//Roles Permissions
// Roles Permissions
if (count($rolesPermissions) > 0) {
global $RBAC;
foreach ($rolesPermissions as $value) {
@@ -3354,7 +3353,7 @@ class Cases
}
}
//Object Permissions
// Object Permissions
if (count($objectPermissions) > 0) {
$case = new ClassesCases();
foreach ($objectPermissions as $key => $value) {

View File

@@ -563,4 +563,22 @@ class Delegation extends Model
return $arrayOpenThreads;
}
/**
* Return if the user has participation in the case
*
* @param string $appUid, Case key
* @param string $userUid, User key
*
* @return boolean
*/
public static function participation($appUid, $userUid)
{
$query = Delegation::query()->select();
$query->where('APP_UID', $appUid);
$query->where('USR_UID', $userUid);
$query->limit(1);
return ($query->count() > 0);
}
}