" . $this->getSessionMessageForSupervisor() . "
@@ -2629,4 +2638,54 @@ class PmDynaform
}
};
}
+
+ /**
+ * Get html navigation bar for steps to revise.
+ * @param string $appUid
+ * @param string $uid
+ * @param int $delIndex
+ * @return string
+ */
+ public static function navigationBarForStepsToRevise(string $appUid, string $uid, int $delIndex): string
+ {
+ $navbar = '';
+ $cases = new Cases();
+ $steps = $cases->getAllUrlStepsToRevise($appUid, $delIndex);
+ $n = count($steps);
+ foreach ($steps as $key => $step) {
+ if ($step['uid'] === $uid) {
+ $previousLabel = '';
+ $previousUrl = '';
+ $nextLabel = '';
+ $nextUrl = '';
+ if ($key - 1 >= 0) {
+ $previousLabel = G::LoadTranslation('ID_PREVIOUS');
+ $previousUrl = $steps[$key - 1]['url'];
+ }
+ if ($key + 1 < $n) {
+ $nextLabel = G::LoadTranslation('ID_NEXT');
+ $nextUrl = $steps[$key + 1]['url'];
+ }
+ if (empty($nextUrl)) {
+ $nextLabel = G::LoadTranslation('ID_FINISH');
+ $nextUrl = 'javascript:if(window.parent && window.parent.parent){window.parent.parent.postMessage("redirect=MyCases","*");}';
+ }
+ //this condition modify the next Url for submit action
+ if ($step['type'] === 'DYNAFORM') {
+ $nextUrl = 'javascript:document.querySelector(".pmdynaform-container .pmdynaform-form").submit();';
+ }
+ $navbar = "
";
+ }
+ }
+ return $navbar;
+ }
}
diff --git a/workflow/engine/classes/WsBase.php b/workflow/engine/classes/WsBase.php
index 1569b9595..631e5e23c 100644
--- a/workflow/engine/classes/WsBase.php
+++ b/workflow/engine/classes/WsBase.php
@@ -12,6 +12,7 @@ use ProcessMaker\Core\JobsManager;
use ProcessMaker\Core\System;
use ProcessMaker\Model\Application;
use ProcessMaker\Model\Delegation;
+use ProcessMaker\Model\Task;
class WsBase
{
@@ -2989,15 +2990,31 @@ class WsBase
}
$tasUid = $aRow['TAS_UID'];
- $derivation = new Derivation();
- $userList = $derivation->getAllUsersFromAnyTask($tasUid, true);
+ $task = Task::where('TAS_UID', '=', $tasUid)->first();
+ $type = $task->TAS_ASSIGN_TYPE;
+ $variable = $task->TAS_GROUP_VARIABLE;
+
+ if ($type === 'SELF_SERVICE' && $variable !== '') {
+ $cases = new BmCases();
+ $usersToReasign = $cases->usersToReassign($sessionId, $tasUid, $caseId)['data'];
+ $userList = [];
+ foreach ($usersToReasign as $user){
+ $userList[] = $user['USR_UID'];
+ }
+ } else {
+ $derivation = new Derivation();
+ $userList = $derivation->getAllUsersFromAnyTask($tasUid, true);
+ }
if (!in_array($userIdTarget, $userList)) {
- $result = new WsResponse(34, G::loadTranslation('ID_TARGET_USER_DOES_NOT_HAVE_RIGHTS'));
-
- $g->sessionVarRestore();
-
- return $result;
+ $bmCase = new BmCases();
+ if (!$bmCase->isSupervisor($userIdTarget, $rows['APP_NUMBER'])){
+ $result = new WsResponse(34, G::loadTranslation('ID_TARGET_USER_DOES_NOT_HAVE_RIGHTS'));
+
+ $g->sessionVarRestore();
+
+ return $result;
+ }
}
/**
diff --git a/workflow/engine/content/translations/english/processmaker.en.po b/workflow/engine/content/translations/english/processmaker.en.po
index 9723384c4..67001106b 100755
--- a/workflow/engine/content/translations/english/processmaker.en.po
+++ b/workflow/engine/content/translations/english/processmaker.en.po
@@ -2419,6 +2419,12 @@ msgstr "Array of variables is empty"
msgid "Assign"
msgstr "Assign"
+# TRANSLATION
+# LABEL/ID_ASSIGN_CASE
+#: LABEL/ID_ASSIGN_CASE
+msgid "Assign Case"
+msgstr "Assign Case"
+
# TRANSLATION
# LABEL/ID_ASSIGNED_FIEDS
#: LABEL/ID_ASSIGNED_FIEDS
@@ -2527,6 +2533,12 @@ msgstr "Assign group to"
msgid "Assign Manager To Department"
msgstr "Assign Manager To Department"
+# TRANSLATION
+# LABEL/ID_ASSIGN_NOTIFICATION
+#: LABEL/ID_ASSIGN_NOTIFICATION
+msgid "You were assigned to case #{0}."
+msgstr "You were assigned to case #{0}."
+
# TRANSLATION
# LABEL/ID_ASSIGN_ROLE
#: LABEL/ID_ASSIGN_ROLE
@@ -4019,6 +4031,12 @@ msgstr "The case {0}: {1} with {2}: {3} does not exist."
msgid "Case Description"
msgstr "Case Description"
+# TRANSLATION
+# LABEL/ID_CASE_DETAILS
+#: LABEL/ID_CASE_DETAILS
+msgid "Case Details"
+msgstr "Case Details"
+
# TRANSLATION
# LABEL/ID_CASE_DOES_NOT_EXIST
#: LABEL/ID_CASE_DOES_NOT_EXIST
@@ -24011,6 +24029,12 @@ msgstr "Resume"
msgid "Return"
msgstr "Return"
+# TRANSLATION
+# LABEL/ID_REVIEW_CASE
+#: LABEL/ID_REVIEW_CASE
+msgid "Review Case"
+msgstr "Review Case"
+
# TRANSLATION
# LABEL/ID_RIGHT
#: LABEL/ID_RIGHT
diff --git a/workflow/engine/data/mysql/insert.sql b/workflow/engine/data/mysql/insert.sql
index 8bb2549d7..d867fc689 100755
--- a/workflow/engine/data/mysql/insert.sql
+++ b/workflow/engine/data/mysql/insert.sql
@@ -57205,6 +57205,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
( 'LABEL','ID_ARE_YOU_SURE_UNPAUSE_TASK','en','Are you sure want to unpause the task?','2021-01-26') ,
( 'LABEL','ID_ARRAY_VARIABLES_EMPTY','en','Array of variables is empty','2014-01-15') ,
( 'LABEL','ID_ASSIGN','en','Assign','2014-01-15') ,
+( 'LABEL','ID_ASSIGN_CASE','en','Assign Case','2022-11-04') ,
( 'LABEL','ID_ASSIGNED_FIEDS','en','ASSIGNED FIELDS','2014-01-15') ,
( 'LABEL','ID_ASSIGNED_GROUPS','en','ASSIGNED GROUPS','2014-01-15') ,
( 'LABEL','ID_ASSIGNED_MEMBERS','en','MEMBERS','2014-01-15') ,
@@ -57225,6 +57226,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
( 'LABEL','ID_ASSIGN_GROUP_TASK','en','Assign Group Task','2015-02-20') ,
( 'LABEL','ID_ASSIGN_GROUP_TO','en','Assign group to','2014-01-15') ,
( 'LABEL','ID_ASSIGN_MANAGER_TO_DEPARTAMENT','en','Assign Manager To Department','2014-10-21') ,
+( 'LABEL','ID_ASSIGN_NOTIFICATION','en','You were assigned to case #{0}.','2022-12-08') ,
( 'LABEL','ID_ASSIGN_ROLE','en','Assign user','2014-01-15') ,
( 'LABEL','ID_ASSIGN_RULES','en','Error: There is a problem with the next tasks of this process. One of them has manual assignment. Manual assignment shouldn''t be used with sub-processes','2015-02-24') ,
( 'LABEL','ID_ASSIGN_SCREEN','en','Assign Screen','2014-01-15') ,
@@ -57403,6 +57405,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
( 'LABEL','ID_CASEDEMO','en','Case Demo','2014-01-15') ,
( 'LABEL','ID_CASELIST_CAN_NOT_BE_IMPORTED_THE_PMTABLE_NOT_EXIST','en','Custom Case List {0} can not be imported because the PM Table does not exist in this Workspace.','2021-08-20') ,
( 'LABEL','ID_CASE_DELETE_SUCCESFULLY','en','The Case was deleted successfully.','2020-01-08') ,
+( 'LABEL','ID_CASE_DETAILS','en','Case Details','2022-10-25') ,
( 'LABEL','ID_CASE_UID','en','Case Uid','2021-04-04') ,
( 'LABEL','ID_CASE_THREAD_TITLE','en','Case Thread Title','2021-08-27') ,
( 'LABEL','ID_CASE_THREAD_TITLE_NAME','en','Case Thread Title Name','2021-09-29') ,
@@ -60923,6 +60926,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
( 'LABEL','ID_RESTORING_CASE','en','Restoring case','2015-09-15') ,
( 'LABEL','ID_RESULT','en','Result','2014-01-15') ,
( 'LABEL','ID_RESUME','en','Resume','2014-01-15') ,
+( 'LABEL','ID_REVIEW_CASE','en','Review Case','2022-11-10') ,
( 'LABEL','ID_RETURN_ADVANCED_SEARCH','en','Return','2019-07-17') ,
( 'LABEL','ID_RIGHT','en','right','2014-09-18') ,
( 'LABEL','ID_RIGHT_MARGIN','en','Right Margin','2014-01-15') ,
diff --git a/workflow/engine/methods/cases/cases_SaveDataSupervisor.php b/workflow/engine/methods/cases/cases_SaveDataSupervisor.php
index e12d94aa1..845d3fcce 100644
--- a/workflow/engine/methods/cases/cases_SaveDataSupervisor.php
+++ b/workflow/engine/methods/cases/cases_SaveDataSupervisor.php
@@ -1,29 +1,7 @@
.
- *
- * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
- * Coral Gables, FL, 33134, USA, or email info@colosa.com.
- */
-//validate the data post
use ProcessMaker\Plugins\PluginRegistry;
+use ProcessMaker\BusinessModel\Cases as BusinessModelCases;
$dynaForm = DynaformPeer::retrieveByPK($_GET["UID"]);
@@ -210,6 +188,21 @@ if (isset( $_FILES["form"]["name"] ) && count( $_FILES["form"]["name"] ) > 0) {
//Define the STEP_POSITION
$ex = isset($_GET['ex']) ? $_GET['ex'] : 0;
//go to the next step
-$aNextStep = $oCase->getNextSupervisorStep( $_SESSION['PROCESS'], $_SESSION['STEP_POSITION'] );
-G::header( 'Location: cases_StepToRevise?type=DYNAFORM&ex=' . $ex . '&PRO_UID=' . $_SESSION['PROCESS'] . '&DYN_UID=' . $aNextStep['UID'] . '&APP_UID=' . $_SESSION['APPLICATION'] . '&position=' . $aNextStep['POSITION'] . '&DEL_INDEX=' . $_SESSION['INDEX'] );
+$nextSteps = $oCase->getNextSupervisorStep($_SESSION['PROCESS'], $_SESSION['STEP_POSITION']);
+$url = '';
+$steps = (new BusinessModelCases())->getAllUrlStepsToRevise($_SESSION['APPLICATION'], $_SESSION['INDEX']);
+$n = count($steps);
+foreach ($steps as $key => $step) {
+ if ($step['uid'] === $nextSteps['UID'] && $key + 1 < $n) {
+ $nextUrl = $steps[$key + 1]['url'];
+ $url = $nextUrl;
+ break;
+ }
+}
+if (empty($url)) {
+ die('');
+}
+G::header('Location:' . $url);
die();
\ No newline at end of file
diff --git a/workflow/engine/methods/cases/cases_StepToRevise.php b/workflow/engine/methods/cases/cases_StepToRevise.php
index 30d9ad870..e68448e40 100644
--- a/workflow/engine/methods/cases/cases_StepToRevise.php
+++ b/workflow/engine/methods/cases/cases_StepToRevise.php
@@ -1,28 +1,4 @@
.
- *
- * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
- * Coral Gables, FL, 33134, USA, or email info@colosa.com.
- */
-// die("first");
-/* Permissions */
$filter = new InputFilter();
$_GET = $filter->xssFilterHard($_GET, "url");
@@ -151,7 +127,7 @@ if ($_GET['DYN_UID'] != '') {
$FieldsPmDynaform["CURRENT_DYNAFORM"] = $_GET['DYN_UID'];
$a = new PmDynaform($FieldsPmDynaform);
if ($a->isResponsive()) {
- $a->printEditSupervisor();
+ $a->printEditSupervisor(['DEL_INDEX' => $_GET['DEL_INDEX']]);
} else {
$G_PUBLISH->AddContent('dynaform', 'xmlform', $_SESSION['PROCESS'] . '/' . $_GET['DYN_UID'], '', $Fields['APP_DATA'], 'cases_SaveDataSupervisor?UID=' . $_GET['DYN_UID'] . '&ex=' . $_GET['ex']);
}
diff --git a/workflow/engine/methods/cases/cases_StepToReviseInputs.php b/workflow/engine/methods/cases/cases_StepToReviseInputs.php
index 077240d2b..c15021e75 100644
--- a/workflow/engine/methods/cases/cases_StepToReviseInputs.php
+++ b/workflow/engine/methods/cases/cases_StepToReviseInputs.php
@@ -1,28 +1,4 @@
.
- *
- * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
- * Coral Gables, FL, 33134, USA, or email info@colosa.com.
- */
-//die("second");
-/* Permissions */
$filter = new InputFilter();
$_GET = $filter->xssFilterHard($_GET, "url");
@@ -119,13 +95,8 @@ if (! isset($_GET['INP_DOC_UID'])) {
$Fields['MESSAGE2'] = G::LoadTranslation('ID_PLEASE_SELECT_FILE');
$docName = $Fields['INP_DOC_TITLE'];
$oHeadPublisher->addScriptCode('var documentName=\'Reviewing Input Document
' . $docName . '\';');
- // $G_PUBLISH->AddContent('xmlform', 'xmlform', $sXmlForm, '', $Fields, 'cases_SupervisorSaveDocument?UID=' .
- //$_GET['INP_DOC_UID'] . '&APP_UID=' . $_GET['APP_UID'] . '&position=' . $_GET['position']);
- $G_PUBLISH->AddContent('propeltable', 'cases/paged-table-inputDocumentsToRevise', 'cases/cases_ToReviseInputdocsList', $oCase->getInputDocumentsCriteria($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_GET['INP_DOC_UID']), array_merge(array('DOC_UID' => $_GET['INP_DOC_UID']
- ), $Fields));
- //$aFields
- // $G_PUBLISH->AddContent('propeltable', 'cases/paged-table-inputDocuments', 'cases/cases_InputdocsList',
- //$oCase->getInputDocumentsCriteria($_SESSION['APPLICATION']));//$aFields
+ $G_PUBLISH->AddContent('view','cases/paged-table-inputDocumentsToReviseNavBar');
+ $G_PUBLISH->AddContent('propeltable', 'cases/paged-table-inputDocumentsToRevise', 'cases/cases_ToReviseInputdocsList', $oCase->getInputDocumentsCriteria($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_GET['INP_DOC_UID']), array_merge(['DOC_UID' => $_GET['INP_DOC_UID']], $Fields));
}
G::RenderPage('publish', 'blank');
diff --git a/workflow/engine/skinEngine/neoclassic/css/app.css b/workflow/engine/skinEngine/neoclassic/css/app.css
index 4d3313b8d..76fd761ec 100644
--- a/workflow/engine/skinEngine/neoclassic/css/app.css
+++ b/workflow/engine/skinEngine/neoclassic/css/app.css
@@ -473,7 +473,7 @@ a:hover {
}
.card-body {
- background-color: #5aa4c4;
+ background-color: #0099DC;
color: #fff;
-ms-flex: 1 1 auto;
flex: 1 1 auto;
diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php b/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php
old mode 100644
new mode 100755
index 8da2870e2..3285b312c
--- a/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php
+++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php
@@ -53,9 +53,13 @@ use ProcessMaker\Model\AppNotes as Notes;
use ProcessMaker\Model\AppTimeoutAction;
use ProcessMaker\Model\Delegation;
use ProcessMaker\Model\Documents;
+use ProcessMaker\Model\Groupwf;
+use ProcessMaker\Model\GroupUser;
use ProcessMaker\Model\ListUnassigned;
use ProcessMaker\Model\Triggers;
use ProcessMaker\Model\ProcessUser;
+use ProcessMaker\Model\StepSupervisor;
+use ProcessMaker\Model\Task;
use ProcessMaker\Model\User;
use ProcessMaker\Plugins\PluginRegistry;
use ProcessMaker\Services\Api;
@@ -904,6 +908,26 @@ class Cases
return $permission;
}
+ /**
+ * Review if the user is supervisor
+ *
+ * @param string $usrUid
+ * @param int $caseNumber
+ *
+ * @return bool
+ */
+ public function isSupervisor(string $usrUid, int $caseNumber)
+ {
+ $result = [];
+ $user = new BmUser();
+ if ($user->checkPermission($usrUid, 'PM_SUPERVISOR')) {
+ $processes = ProcessUser::getProcessesOfSupervisor($usrUid);
+ $query = Delegation::query()->select(['APP_NUMBER'])->case($caseNumber)->processInList($processes);
+ $result = $query->get()->values()->toArray();
+ }
+ return !empty($result);
+ }
+
/**
* Reassign Case
*
@@ -911,7 +935,7 @@ class Cases
* @param string $usrUid Unique id of User
* @param int $delIndex
* @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 boolean $sendMail
*
@@ -939,11 +963,20 @@ class Cases
/** Add the note */
if (!empty($reason)) {
- $noteContent = $reason;
- // Define the Case for register a case note
- $cases = new BmCases();
- $response = $cases->addNote($appUid, $usrUid, $noteContent, $sendMail);
+ $this->sendMail($appUid, $usrUid, $reason, $sendMail, $userTarget);
}
+
+ // 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) {
throw $e;
}
@@ -1120,13 +1153,15 @@ class Cases
* @param string $appUid
* @param integer $index
* @param string $userUid
+ * @param string $action
+ * @param string $reason
*
* @return void
* @throws Exception
*
* @access public
*/
- public function putClaimCase($appUid, $index, $userUid)
+ public function putClaimCase($appUid, $index, $userUid, $action, $reason = '')
{
// Validate the parameters
Validator::isString($appUid, '$appUid');
@@ -1139,19 +1174,33 @@ class Cases
$appDelegation = new AppDelegation();
$delegation = $appDelegation->load($appUid, $index);
if (empty($delegation['USR_UID'])) {
- $case = new ClassesCases();
- $case->loadCase($appUid);
+ $classesCase = new ClassesCases();
+ $case = $classesCase->loadCase($appUid);
//Review if the user can be claim the case
- if (!$case->isSelfService($userUid, $delegation['TAS_UID'], $appUid)) {
- $message = preg_replace("#
#i", "", G::LoadTranslation("ID_NO_PERMISSION_NO_PARTICIPATED"));
- throw new Exception($message);
+ if (!$classesCase->isSelfService($userUid, $delegation['TAS_UID'], $appUid)) {
+ if (!$this->isSupervisor($userUid, $case['APP_NUMBER'])){
+ $message = preg_replace("#
#i", "", G::LoadTranslation("ID_NO_PERMISSION_NO_PARTICIPATED"));
+ throw new Exception($message);
+ }
}
-
- $case->setCatchUser($appUid, $index, $userUid);
+ $classesCase->setCatchUser($appUid, $index, $userUid);
} else {
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));
}
/**
@@ -2741,6 +2790,70 @@ class Cases
}
}
+ /**
+ * Get Users to reassign
+ *
+ * @param string $userUid Unique id of User (User logged)
+ * @param string $taskUid Unique id of Task
+ * @param string $appUid Unique id of Application
+ *
+ * @return array Return Users to reassign
+ * @throws Exception
+ */
+ public function usersToReassign(
+ $userUid,
+ $taskUid,
+ $appUid
+ ) {
+ $task = Task::where('TAS_UID', '=', $taskUid)->first();
+ $type = $task->TAS_ASSIGN_TYPE;
+ $variable = $task->TAS_GROUP_VARIABLE;
+ $result = [];
+
+ if ($type === 'SELF_SERVICE' && $variable !== '') {
+ $variable = substr($variable, 2);
+ $fields = ModelApplication::where('APP_UID', '=', $appUid)->first();
+ $data = ClassesCases::unserializeData($fields->APP_DATA);
+
+ $row = [];
+
+ if (!empty($data[$variable])) {
+ foreach ($data[$variable] as $uid) {
+ $group = Groupwf::where('GRP_UID', '=', $uid)->first();
+ if (!empty($group)) {
+ $usersOfGroup = GroupUser::where('GRP_UID', '=', $uid)->get()->toArray();
+ foreach ($usersOfGroup as $data) {
+ $row[] = $data['USR_UID'];
+ }
+ } else {
+ $row[] = $uid;
+ }
+ }
+ }
+
+ $users = [];
+ foreach ($row as $data) {
+ $obj = User::where('USR_UID', '=', $data)->Active()->first();
+ if (!is_null($obj) && $obj->USR_USERNAME !== "") {
+ $users[] = $obj;
+ }
+ }
+
+ foreach ($users as $user) {
+ $result[] = [
+ "USR_UID" => $user->USR_UID,
+ "USR_USERNAME" => $user->USR_USERNAME,
+ "USR_FIRSTNAME" => $user->USR_FIRSTNAME,
+ "USR_LASTNAME"=> $user->USR_LASTNAME
+ ];
+ }
+
+ } else {
+ $result = $this->getUsersToReassign($userUid, $taskUid)['data'];
+ }
+ return ['data' => $result];
+ }
+
/**
* Get Users to reassign
*
@@ -3944,6 +4057,47 @@ class Cases
return $result;
}
+ /**
+ * Send mail to notify and Add a case note
+ *
+ * @param string $appUid
+ * @param string $userUid
+ * @param string $note
+ * @param bool $sendMail
+ * @param string $toUser
+ *
+ */
+ public function sendMail($appUid, $userUid, $note, $sendMail = false, $toUser = '')
+ {
+
+ $appNumber = ModelApplication::getCaseNumber($appUid);
+
+ // Register the note
+ $attributes = [
+ "APP_UID" => $appUid,
+ "APP_NUMBER" => $appNumber,
+ "USR_UID" => $userUid,
+ "NOTE_DATE" => date("Y-m-d H:i:s"),
+ "NOTE_CONTENT" => $note,
+ "NOTE_TYPE" => "USER",
+ "NOTE_AVAILABILITY" => "PUBLIC",
+ "NOTE_RECIPIENTS" => ""
+ ];
+ $newNote = Notes::create($attributes);
+
+ // Send the email
+ if ($sendMail) {
+ // Get the FK
+ $noteId = $newNote->NOTE_ID;
+
+ $note = G::LoadTranslation('ID_ASSIGN_NOTIFICATION', [$appNumber]) . '
' . G::LoadTranslation('ID_REASON') . ': ' . stripslashes($note);
+
+ // Send the notification
+ $appNote = new AppNotes();
+ $appNote->sendNoteNotification($appUid, $userUid, $note, $toUser, '', 0, $noteId);
+ }
+ }
+
/**
* Upload file related to the case notes
*
@@ -4300,4 +4454,68 @@ class Cases
// Return results
return $dynaForms;
}
+
+ /**
+ * Get objects that they have send it.
+ * @param string $appUid
+ * @param string $typeObject
+ * @return array
+ */
+ public function getStepsToRevise(string $appUid, string $typeObject): array
+ {
+ $application = ModelApplication::where('APP_UID', '=', $appUid)
+ ->first();
+ $result = StepSupervisor::where('PRO_UID', '=', $application['PRO_UID'])->
+ where('STEP_TYPE_OBJ', '=', $typeObject)->
+ orderBy('STEP_POSITION', 'ASC')->
+ get()->
+ toArray();
+ return $result;
+ }
+
+ /**
+ * Get all url steps to revise.
+ * @param string $appUid
+ * @param int $delIndex
+ * @return array
+ */
+ public function getAllUrlStepsToRevise(string $appUid, int $delIndex): array
+ {
+ $result = [];
+ $dynaformStep = $this->getStepsToRevise($appUid, 'DYNAFORM');
+ $inputDocumentStep = $this->getStepsToRevise($appUid, 'INPUT_DOCUMENT');
+ $objects = array_merge($dynaformStep, $inputDocumentStep);
+ usort($objects, function ($a, $b) {
+ return $a['STEP_POSITION'] > $b['STEP_POSITION'];
+ });
+ $i = 0;
+ $endPoint = '';
+ $uidName = '';
+ foreach ($objects as $step) {
+ if ($step['STEP_TYPE_OBJ'] === 'DYNAFORM') {
+ $endPoint = 'cases_StepToRevise';
+ $uidName = 'DYN_UID';
+ }
+ if ($step['STEP_TYPE_OBJ'] === 'INPUT_DOCUMENT') {
+ $endPoint = 'cases_StepToReviseInputs';
+ $uidName = 'INP_DOC_UID';
+ }
+ $url = "{$endPoint}?"
+ . "type={$step['STEP_TYPE_OBJ']}&"
+ . "ex={$i}&"
+ . "PRO_UID={$step["PRO_UID"]}&"
+ . "{$uidName}={$step['STEP_UID_OBJ']}&"
+ . "APP_UID={$appUid}&"
+ . "position={$step['STEP_POSITION']}&"
+ . "DEL_INDEX={$delIndex}";
+ $result[] = [
+ 'uid' => $step['STEP_UID_OBJ'],
+ 'type' => $step['STEP_TYPE_OBJ'],
+ 'url' => $url
+ ];
+ $i++;
+ }
+ return $result;
+ }
+
}
diff --git a/workflow/engine/src/ProcessMaker/Model/StepSupervisor.php b/workflow/engine/src/ProcessMaker/Model/StepSupervisor.php
new file mode 100644
index 000000000..a40c8d172
--- /dev/null
+++ b/workflow/engine/src/ProcessMaker/Model/StepSupervisor.php
@@ -0,0 +1,17 @@
+getUserId();
$cases = new BmCases();
- $cases->putClaimCase($appUid, $index, $userUid);
+ $cases->putClaimCase($appUid, $index, $userUid, 'Claim');
+ } catch (Exception $e) {
+ throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
+ }
+ }
+
+ /**
+ * Verify if current user is a supervisor
+ *
+ * @url GET /:appNumber/supervisor
+ *
+ * @param int $appNumber
+ *
+ * @return boolean
+ * @throws RestException
+ *
+ * @access protected
+ * @class AccessControl {@permission PM_CASES}
+ */
+ public function isSupervisor(int $appNumber)
+ {
+ try {
+ $userUid = $this->getUserId();
+ $cases = new BmCases();
+ return $cases->isSupervisor($userUid, $appNumber);
+ } catch (Exception $e) {
+ throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
+ }
+ }
+
+ /**
+ * Assign Case
+ *
+ * @url PUT /:appUid/:usrUid/assign
+ *
+ * @param string $appUid {@min 1}{@max 32}
+ * @param string $usrUid {@min 1}{@max 32}
+ * @param int $index {@from body}
+ * @param string $reason {@from body}
+ * @param bool $sendMail {@from body}
+ *
+ * @throws RestException
+ *
+ * @access protected
+ * @class AccessControl {@permission PM_CASES}
+ */
+ public function doPutAssignCase($appUid, $usrUid, $index, $reason = '', $sendMail = false)
+ {
+ try {
+ $cases = new BmCases();
+ $cases->putClaimCase($appUid, $index, $usrUid, 'Assign', $reason);
+
+ /** Add the note */
+ if (!empty($reason)) {
+ $currentUserUid = $this->getUserId();
+ $cases->sendMail($appUid, $currentUserUid, $reason, $sendMail, $usrUid);
+ }
+ } catch (Exception $e) {
+ throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
+ }
+ }
+
+ /**
+ * Get users to reassign or assign
+ *
+ * @url GET /:task_uid/:app_uid/userstoreassign
+ *
+ * @param string $task_uid
+ * @param string $app_uid
+ *
+ * @return array
+ * @throws RestException
+ *
+ * @access protected
+ * @class AccessControl {@permission PM_CASES}
+ */
+ public function usersToReasign($task_uid, $app_uid)
+ {
+ try {
+ $usr_uid = $this->getUserId();
+ $cases = new BmCases();
+ return $cases->usersToReassign($usr_uid, $task_uid, $app_uid);
} catch (Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
diff --git a/workflow/engine/templates/cases/open.js b/workflow/engine/templates/cases/open.js
index e34d7f25b..43ef8bb17 100644
--- a/workflow/engine/templates/cases/open.js
+++ b/workflow/engine/templates/cases/open.js
@@ -531,7 +531,8 @@ Ext.onReady(function(){
},
iconCls: 'ICON_STEPS',
toggleHandler: togglePreview,
- disabled: true
+ disabled: true,
+ hidden: true
}, {
id: 'informationMenu',
text: _('ID_INFORMATION'),
diff --git a/workflow/engine/templates/cases/paged-table-inputDocumentsToReviseNavBar.php b/workflow/engine/templates/cases/paged-table-inputDocumentsToReviseNavBar.php
new file mode 100644
index 000000000..5a22dbc39
--- /dev/null
+++ b/workflow/engine/templates/cases/paged-table-inputDocumentsToReviseNavBar.php
@@ -0,0 +1,11 @@
+'
+ . ''
+ . '