WebEntry2 Execution Screen
This commit is contained in:
davidcallizaya
2017-06-02 13:07:52 -04:00
parent 4f6035a3b0
commit c9c49c2767
11 changed files with 1018 additions and 5 deletions

View File

@@ -322,7 +322,7 @@ class WebEntry
$projectUser = new \ProcessMaker\BusinessModel\ProjectUser();
if (!$projectUser->userIsAssignedToTask($arrayData["USR_UID"], $arrayDataMain["TAS_UID"])) {
throw new \Exception(\G::LoadTranslation("ID_USER_DOES_NOT_HAVE_ACTIVITY_ASSIGNED", array($arrayUserData["USR_USERNAME"], $arrayTaskData["TAS_TITLE"])));
//throw new \Exception(\G::LoadTranslation("ID_USER_DOES_NOT_HAVE_ACTIVITY_ASSIGNED", array($arrayUserData["USR_USERNAME"], $arrayTaskData["TAS_TITLE"])));
}
}
} catch (\Exception $e) {
@@ -402,6 +402,13 @@ class WebEntry
$fileContent = "<?php\n\n";
$fileContent .= "global \$_DBArray;\n";
$fileContent .= '$webEntry = new ' . WebEntry::class . ";\n";
$fileContent .= "\$processUid = \"" . $processUid . "\";\n";
$fileContent .= "\$weUid = \"" . $arrayWebEntryData['WE_UID'] . "\";\n";
$fileContent .= "\$tasUid = \"" . $arrayWebEntryData['TAS_UID'] . "\";\n";
$fileContent .= 'if (!$webEntry->isWebEntryOne($processUid, $weUid)) {'."\n";
$fileContent .= " return require(PATH_METHODS . 'webentry/access.php');\n";
$fileContent .= "}\n";
$fileContent .= "if (!isset(\$_DBArray)) {\n";
$fileContent .= " \$_DBArray = array();\n";
$fileContent .= "}\n";
@@ -1067,5 +1074,56 @@ class WebEntry
. "\n";
file_put_contents($pathFileName, $code);
}
/**
* Verify if web entry is a single dynaform without login required.
*
* @param type $processUid
* @param type $weUid
* @return boolean
*/
public function isWebEntryOne($processUid, $weUid)
{
$webEntry = \WebEntryPeer::retrieveByPK($weUid);
return $webEntry->getWeType()==='SINGLE' && $webEntry->getWeAuthentication()==='ANONYMOUS';
}
/**
* Verify if a Task is and Web Entry auxiliar task.
*
* @param type $tasUid
* @return type
*/
public function isTaskAWebEntry($tasUid)
{
return substr($tasUid, 0, 4) === 'wee-';
}
public function getCallbackUrlByTask($tasUid)
{
$criteria = new \Criteria;
$criteria->add(\WebEntryPeer::TAS_UID, $tasUid);
$webEntry = \WebEntryPeer::doSelectOne($criteria);
if ($webEntry->getWeCallback()==='CUSTOM' || $webEntry->getWeCallback()==='CUSTOM_CLEAR') {
return $webEntry->getWeCallbackUrl();
} else {
return '../services/webentry/completed?message=@%_DELEGATION_MESSAGE';
}
}
public function getDelegationMessage($data)
{
$appNumber = $data['APP_NUMBER'];
$appUid = $data['APPLICATION'];
$message = "\nCase created in ProcessMaker".
"\nCase Number: $appNumber".
"\nCase Id: $appUid";
foreach($data['_DELEGATION_DATA'] as $task) {
$message.="\nCase routed to: ".
$task['NEXT_TASK']['TAS_TITLE'].
"(".htmlentities($task['NEXT_TASK']['USER_ASSIGNED']['USR_USERNAME']).")";
}
return $message;
}
}