diff --git a/workflow/engine/classes/Cases.php b/workflow/engine/classes/Cases.php index 705f6c0ae..c22ab96b6 100644 --- a/workflow/engine/classes/Cases.php +++ b/workflow/engine/classes/Cases.php @@ -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; } } - diff --git a/workflow/engine/methods/cases/casesStartPage_Ajax.php b/workflow/engine/methods/cases/casesStartPage_Ajax.php index 7caf8fc1d..585a46b4d 100644 --- a/workflow/engine/methods/cases/casesStartPage_Ajax.php +++ b/workflow/engine/methods/cases/casesStartPage_Ajax.php @@ -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 ) ); } - diff --git a/workflow/engine/methods/login/session.php b/workflow/engine/methods/login/session.php new file mode 100644 index 000000000..08304ae6e --- /dev/null +++ b/workflow/engine/methods/login/session.php @@ -0,0 +1,68 @@ +loadConfig($obj, 'ENVIRONMENT_SETTINGS', ''); + +echo ''; + +echo ''; +echo ''; + +foreach (['_SESSION' => $_SESSION, '_COOKIE' => $_COOKIE, '_ENV' => $_ENV] as $varName => $varData) { + foreach ($varData as $key => $value) { + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + } +} + +echo '
VariableKeyValue
' . htmlspecialchars($varName) . '' . htmlspecialchars($key) . '' . htmlspecialchars(is_array($value) ? json_encode($value) : $value) . '
'; +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(); +} diff --git a/workflow/engine/src/ProcessMaker/Services/Api.php b/workflow/engine/src/ProcessMaker/Services/Api.php index 416e15fc0..0d33f44a2 100644 --- a/workflow/engine/src/ProcessMaker/Services/Api.php +++ b/workflow/engine/src/ProcessMaker/Services/Api.php @@ -42,4 +42,3 @@ abstract class Api return \ProcessMaker\Services\OAuth2\Server::getUserId(); } } - diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Project/WebEntry.php b/workflow/engine/src/ProcessMaker/Services/Api/Project/WebEntry.php index 066aceadf..288498614 100644 --- a/workflow/engine/src/ProcessMaker/Services/Api/Project/WebEntry.php +++ b/workflow/engine/src/ProcessMaker/Services/Api/Project/WebEntry.php @@ -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 } } } - diff --git a/workflow/public_html/sysGeneric.php b/workflow/public_html/sysGeneric.php index 6dccb81cc..1ff7054c0 100644 --- a/workflow/public_html/sysGeneric.php +++ b/workflow/public_html/sysGeneric.php @@ -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; }