diff --git a/phpunit.xml b/phpunit.xml index bdec9bbb5..6978f61fb 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -54,8 +54,8 @@ - - + + diff --git a/tests/WorkflowTestCase.php b/tests/WorkflowTestCase.php index aecfbd5a1..8551e5cc4 100644 --- a/tests/WorkflowTestCase.php +++ b/tests/WorkflowTestCase.php @@ -40,7 +40,7 @@ class WorkflowTestCase extends TestCase /** * Import a process to the database. - * + * * @param type $filename ProcessMaker file to be imported * @return string PRO_UID */ @@ -81,7 +81,7 @@ class WorkflowTestCase extends TestCase /** * Clear all the translated messages loaded. - * + * * @global array $translation */ protected function clearTranslations() diff --git a/workflow/engine/methods/cases/cases_Step.php b/workflow/engine/methods/cases/cases_Step.php index 6ff7859ba..e4c26d8ac 100644 --- a/workflow/engine/methods/cases/cases_Step.php +++ b/workflow/engine/methods/cases/cases_Step.php @@ -161,6 +161,7 @@ $G_PUBLISH->AddContent( 'template', '', '', '', $oTemplatePower ); $oCase = new Cases(); $oStep = new Step(); +$bmWebEntry = new \ProcessMaker\BusinessModel\WebEntry; $Fields = $oCase->loadCase( $_SESSION['APPLICATION'] ); $Fields['APP_DATA'] = array_merge( $Fields['APP_DATA'], G::getSystemConstants() ); @@ -295,6 +296,9 @@ try { if (isset( $oProcessFieds['PRO_SHOW_MESSAGE'] )) { $noShowTitle = $oProcessFieds['PRO_SHOW_MESSAGE']; } + if ($bmWebEntry->isTaskAWebEntry($_SESSION['TASK'])) { + $noShowTitle = 1; + } switch ($_GET['TYPE']) { case 'DYNAFORM': @@ -1105,6 +1109,28 @@ try { $aFields["TASK"][$sKey]["NEXT_TASK"]["TAS_TITLE"] = G::LoadTranslation("ID_ROUTE_TO_TASK_INTERMEDIATE_CATCH_MESSAGE_EVENT"); } + //SKIP ASSIGN SCRREN + if (!empty($aFields['TASK'][1])) { + $currentTask = $aFields['TASK'][1]; + $isWebEntry = $bmWebEntry->isTaskAWebEntry($currentTask['TAS_UID']); + $skipRoutingScreen = $isWebEntry; + if ($isWebEntry) { + $tplFile = 'webentry/cases_ScreenDerivation'; + $caseId = $currentTask['APP_UID']; + $delIndex = $currentTask['DEL_INDEX']; + $derivationResponse = PMFDerivateCase($caseId, $delIndex, true); + if ($derivationResponse) { + $webEntryUrl = $bmWebEntry->getCallbackUrlByTask($currentTask['TAS_UID']); + $delegationData = $Fields['APP_DATA']; + $delegationData['_DELEGATION_DATA'] = $aFields['TASK']; + $delegationData['_DELEGATION_MESSAGE'] = $bmWebEntry->getDelegationMessage($delegationData); + $webEntryUrlEvaluated = \G::replaceDataField($webEntryUrl, $delegationData); + } + $aFields['derivationResponse'] = $derivationResponse; + $aFields['webEntryUrlEvaluated'] = $webEntryUrlEvaluated; + } + } + $G_PUBLISH->AddContent( 'smarty', $tplFile, '', '', $aFields ); /* if (isset( $aFields['TASK'][1]['NEXT_TASK']['USER_ASSIGNED'])){ diff --git a/workflow/engine/methods/services/webentry/anonymous_login.php b/workflow/engine/methods/services/webentry/anonymous_login.php new file mode 100644 index 000000000..2b8387149 --- /dev/null +++ b/workflow/engine/methods/services/webentry/anonymous_login.php @@ -0,0 +1,44 @@ +getUsrUid(); + $userInfo = PMFInformationUser($userUid); + if (empty($userInfo)) { + throw new \Exception('WebEntry User not found'); + } + + $_SESSION['USER_LOGGED'] = $userUid; + $_SESSION['USR_USERNAME'] = $userInfo['username']; + + $result = [ + 'user_logged' => $userUid, + 'userName' => $userInfo['username'], + 'firstName' => $userInfo['firstname'], + 'lastName' => $userInfo['lastname'], + 'mail' => $userInfo['mail'], + 'image' => '../users/users_ViewPhoto?t='.microtime(true), + ]; +} catch (\Exception $e) { + $result = [ + 'error' => $e->getMessage(), + ]; + http_response_code(500); +} +echo G::json_encode($result); diff --git a/workflow/engine/methods/services/webentry/check_case.php b/workflow/engine/methods/services/webentry/check_case.php new file mode 100644 index 000000000..4165522d8 --- /dev/null +++ b/workflow/engine/methods/services/webentry/check_case.php @@ -0,0 +1,35 @@ +getDelThreadStatus() === 'OPEN' && + $delegation->getUsrUid() === $_SESSION['USER_LOGGED']; + + $result = ["check" => $check]; +} catch (\Exception $e) { + $result = [ + 'error' => $e->getMessage(), + ]; + http_response_code(500); +} +echo G::json_encode($result); diff --git a/workflow/engine/methods/services/webentry/completed.php b/workflow/engine/methods/services/webentry/completed.php new file mode 100644 index 000000000..eb920be82 --- /dev/null +++ b/workflow/engine/methods/services/webentry/completed.php @@ -0,0 +1,18 @@ +AddContent("xmlform", "xmlform", $show, "", $message); +G::RenderPage("publish", "blank"); + diff --git a/workflow/engine/methods/webentry/access.php b/workflow/engine/methods/webentry/access.php new file mode 100644 index 000000000..4631cadb3 --- /dev/null +++ b/workflow/engine/methods/webentry/access.php @@ -0,0 +1,481 @@ +getConfiguration( + "ENVIRONMENT_SETTINGS", + "", + "", + "", + "", + $outResult +); +$userInformationFormat = isset($outResult['format']) ? $outResult['format'] : + '@lastName, @firstName (@userName)'; +$webEntryModel = \WebEntryPeer::retrieveByPK($weUid); +?> + +
+ +