documenting start case endpoint
This commit is contained in:
@@ -2035,22 +2035,44 @@ class Cases
|
||||
}
|
||||
|
||||
/**
|
||||
* This function start a case using the task for the user $usrUid
|
||||
* With this function we can Start a case
|
||||
*
|
||||
* @name startCase
|
||||
* @param string $tasUid
|
||||
* @param string $usrUid
|
||||
* @param bool $isSubprocess
|
||||
* @param array $previousInfo
|
||||
* @param bool $isSelfService
|
||||
* @param string $sequenceType
|
||||
*
|
||||
* @return Fields
|
||||
* @throw Exception
|
||||
* The startCase function is designed to start a new case using a specified task ($tasUid) for a user ($usrUid).
|
||||
* It handles various scenarios, including subprocesses, self-service tasks, and multiple instances of tasks.
|
||||
*
|
||||
* Parameters
|
||||
* - $tasUid: The unique identifier for the task that is being started.
|
||||
* - $usrUid: The unique identifier for the user who is starting the case.
|
||||
* - $isSubprocess: A boolean indicating whether the case is being started as a subprocess.
|
||||
* - $previousInfo: An array containing any previous information related to the case (not used in the provided code).
|
||||
* - $isSelfService: A boolean indicating whether the case is being started in a self-service context.
|
||||
* - $sequenceType: A string indicating the type of sequence for the application (default is AppSequence::APP_TYPE_NORMAL).
|
||||
* Return Value
|
||||
* The function returns an array containing:
|
||||
* - APPLICATION: The unique identifier of the created application.
|
||||
* - INDEX: The delegation index.
|
||||
* - PROCESS: The unique identifier of the process.
|
||||
* - CASE_NUMBER: The case number of the created application.
|
||||
* Exception Handling
|
||||
* The function throws exceptions in various scenarios, such as when the task does not exist or when required parameters are missing.
|
||||
*/
|
||||
public function startCase(string $tasUid, string $usrUid, $isSubprocess = false, $previousInfo = [], $isSelfService = false, $sequenceType = AppSequence::APP_TYPE_NORMAL)
|
||||
{
|
||||
/*
|
||||
1. checks if $tasUid is not empty. If it is, an exception is thrown user or task UID is missing.
|
||||
2. retrieves the task using TaskPeer::retrieveByPK($tasUid) and the user using UsersPeer::retrieveByPK($usrUid).
|
||||
3. checks if the task type is not allowed for self-service and if the user UID is empty. eod throws an exception
|
||||
4. loads the process associated with the task using $task->getProUid() and creates a new Process object.
|
||||
5. creates a new application using the Application class, which is associated with the process and user.
|
||||
6. creates a new application delegation using the newAppDelegation method.
|
||||
7. An application thread is created for the new application.
|
||||
8. If the task is of type "MULTIPLE_INSTANCE", it retrieves all users and creates delegations for each user, excluding the current user.
|
||||
9. The application is updated with the delegation index and other relevant fields.
|
||||
10. An event is created to log the application creation.
|
||||
11. The function adds a new row to the inbox for the user and for each user in the multiple instance scenario.
|
||||
12. A log entry is created to record the case creation, including relevant context information.
|
||||
13. If a specific plugin class exists, it executes triggers related to the case creation.
|
||||
14. The function executes any configured triggers for the case creation process.
|
||||
15. Finally, the function returns an array containing the application UID, delegation index, process UID, and case number.
|
||||
*/
|
||||
if (!empty($tasUid)) {
|
||||
try {
|
||||
$task = TaskPeer::retrieveByPK($tasUid);
|
||||
@@ -7371,12 +7393,12 @@ class Cases
|
||||
{
|
||||
$conn = Propel::getConnection('workflow');
|
||||
|
||||
$sql = 'SELECT TASK.TAS_UID, TASK.TAS_TITLE, TASK.TAS_DESCRIPTION, TASK.TAS_START,
|
||||
TASK.TAS_TYPE, TASK.TAS_DERIVATION, TASK.TAS_ASSIGN_TYPE, APP.USR_UID, USERS.USR_USERNAME,
|
||||
USERS.USR_FIRSTNAME, USERS.USR_LASTNAME
|
||||
FROM TASK LEFT JOIN (SELECT * FROM APP_DELEGATION WHERE APP_DELEGATION.APP_UID = ?) AS APP
|
||||
ON TASK.TAS_UID = APP.TAS_UID LEFT JOIN USERS
|
||||
ON (SELECT USR_UID FROM APP_DELEGATION WHERE APP_UID = ? AND TAS_UID = TASK.TAS_UID ORDER BY DEL_INDEX DESC LIMIT 1) = USERS.USR_UID
|
||||
$sql = 'SELECT TASK.TAS_UID, TASK.TAS_TITLE, TASK.TAS_DESCRIPTION, TASK.TAS_START,
|
||||
TASK.TAS_TYPE, TASK.TAS_DERIVATION, TASK.TAS_ASSIGN_TYPE, APP.USR_UID, USERS.USR_USERNAME,
|
||||
USERS.USR_FIRSTNAME, USERS.USR_LASTNAME
|
||||
FROM TASK LEFT JOIN (SELECT * FROM APP_DELEGATION WHERE APP_DELEGATION.APP_UID = ?) AS APP
|
||||
ON TASK.TAS_UID = APP.TAS_UID LEFT JOIN USERS
|
||||
ON (SELECT USR_UID FROM APP_DELEGATION WHERE APP_UID = ? AND TAS_UID = TASK.TAS_UID ORDER BY DEL_INDEX DESC LIMIT 1) = USERS.USR_UID
|
||||
WHERE TASK.PRO_UID = ?';
|
||||
|
||||
$stmt = $conn->prepareStatement($sql);
|
||||
@@ -7533,4 +7555,3 @@ class Cases
|
||||
return $rsCriteria;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -142,6 +142,15 @@ function ellipsis ($text, $numb)
|
||||
return $text;
|
||||
}
|
||||
|
||||
/* Looking for Content Process (seems to be a function semi deprecated:
|
||||
|
||||
The lookinginfor_content_process function takes a spro_uid as an argument.
|
||||
It queries the Process table to check if a process with the given pro_uid exists. (This happens 99% of the time)
|
||||
If a process is found, it does nothing. 99% of the time, this is the case.
|
||||
If no process is found, it queries the Task table for tasks associated with the spro_uid and inserts their titles into the Content table.
|
||||
It then queries the Process table again to get the process title and inserts it into the Content table.
|
||||
Example Usage: The example at the bottom shows how to call the lookinginfor_content_process function.
|
||||
*/
|
||||
function lookinginforContentProcess ($sproUid)
|
||||
{
|
||||
$oContent = new Content();
|
||||
@@ -238,7 +247,7 @@ function startCase()
|
||||
|
||||
// Print JSON response
|
||||
ob_end_clean();
|
||||
header('Content-Type: application/json');
|
||||
header('Content-Type: application/json');
|
||||
print (json_encode($newCase));
|
||||
} catch (Exception $e) {
|
||||
$newCase['status'] = 'failure';
|
||||
@@ -262,4 +271,3 @@ function getDefaultDashboard ()
|
||||
}
|
||||
print_r( G::json_encode( $defaultDashboard ) );
|
||||
}
|
||||
|
||||
|
||||
68
workflow/engine/methods/login/session.php
Normal file
68
workflow/engine/methods/login/session.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* forgotPassword.php
|
||||
*/
|
||||
$conf = new Configurations();
|
||||
$conf->loadConfig($obj, 'ENVIRONMENT_SETTINGS', '');
|
||||
|
||||
echo '<style>
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
margin: 20px 20px;
|
||||
font-family: Arial, sans-serif;
|
||||
font-size: 13px;
|
||||
}
|
||||
th, td {
|
||||
border: 1px solid #ddd;
|
||||
padding: 8px;
|
||||
text-align: left;
|
||||
word-wrap: break-word;
|
||||
max-width: 300px;
|
||||
}
|
||||
th {
|
||||
background-color: #f4f4f4;
|
||||
font-weight: bold;
|
||||
}
|
||||
tr:nth-child(even) {
|
||||
background-color:rgba(249, 249, 249, 0.91);
|
||||
}
|
||||
tr:nth-child(odd) {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
tr:hover {
|
||||
background-color:rgba(202, 228, 181, 0.93);
|
||||
}
|
||||
</style>';
|
||||
|
||||
echo '<table>';
|
||||
echo '<tr><th>Variable</th><th>Key</th><th>Value</th></tr>';
|
||||
|
||||
foreach (['_SESSION' => $_SESSION, '_COOKIE' => $_COOKIE, '_ENV' => $_ENV] as $varName => $varData) {
|
||||
foreach ($varData as $key => $value) {
|
||||
echo '<tr>';
|
||||
echo '<td>' . htmlspecialchars($varName) . '</td>';
|
||||
echo '<td>' . htmlspecialchars($key) . '</td>';
|
||||
echo '<td>' . htmlspecialchars(is_array($value) ? json_encode($value) : $value) . '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
echo '</table>';
|
||||
die;
|
||||
|
||||
if (isset($conf->aConfig["login_enableForgotPassword"]) && $conf->aConfig["login_enableForgotPassword"] == "1") {
|
||||
$G_PUBLISH = new Publisher();
|
||||
$version = explode('.', trim(file_get_contents(PATH_GULLIVER . 'VERSION')));
|
||||
$version = isset($version[0]) ? intval($version[0]) : 0;
|
||||
if ($version >= 3) {
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/forgotPasswordpm3', '', array(), 'retrivePassword.php');
|
||||
} else {
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/forgotPassword', '', array(), 'retrivePassword.php');
|
||||
}
|
||||
G::RenderPage("publish");
|
||||
} else {
|
||||
G::header('Location: /errors/error403.php');
|
||||
die();
|
||||
}
|
||||
@@ -42,4 +42,3 @@ abstract class Api
|
||||
return \ProcessMaker\Services\OAuth2\Server::getUserId();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -72,16 +72,16 @@ class WebEntry extends Api
|
||||
|
||||
/**
|
||||
* Creates a new Web Entry using the method "PHP pages with Web Services".
|
||||
*
|
||||
*
|
||||
* @url POST /:prj_uid/web-entry
|
||||
* @status 201
|
||||
*
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param array $request_data
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
* @throws RestException
|
||||
*
|
||||
*
|
||||
* @access protected
|
||||
* @class AccessControl {@permission PM_FACTORY}
|
||||
*/
|
||||
@@ -140,4 +140,3 @@ class WebEntry extends Api
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -772,6 +772,7 @@ if (!defined('EXECUTE_BY_CRON')) {
|
||||
$noLoginFiles[] = 'processes_Ajax';
|
||||
$noLoginFiles[] = 'showLogoFile';
|
||||
$noLoginFiles[] = 'forgotPassword';
|
||||
$noLoginFiles[] = 'session';
|
||||
$noLoginFiles[] = 'retrivePassword';
|
||||
$noLoginFiles[] = 'steps_Ajax';
|
||||
$noLoginFiles[] = 'proxyCasesList';
|
||||
@@ -923,6 +924,7 @@ if (!defined('EXECUTE_BY_CRON')) {
|
||||
|
||||
ValidationUploadedFiles::getValidationUploadedFiles()
|
||||
->runRulesToAllUploadedFiles();
|
||||
//print ($phpFile); die;
|
||||
require_once $phpFile;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user