diff --git a/config/app.php b/config/app.php index 548de0a20..1c94fab88 100644 --- a/config/app.php +++ b/config/app.php @@ -14,6 +14,7 @@ return [ 'cache_lifetime' => env('APP_CACHE_LIFETIME', 60), 'key' => env('APP_KEY', 'base64:rU28h/tElUn/eiLY0qC24jJq1rakvAFRoRl1DWxj/kM='), 'cipher' => 'AES-256-CBC', + 'timezone' => 'UTC', 'providers' => [ CacheServiceProvider::class, FilesystemServiceProvider::class, diff --git a/framework/src/Maveriks/Extension/Restler/UploadFormat.php b/framework/src/Maveriks/Extension/Restler/UploadFormat.php index be0e01655..5f85d8ebd 100644 --- a/framework/src/Maveriks/Extension/Restler/UploadFormat.php +++ b/framework/src/Maveriks/Extension/Restler/UploadFormat.php @@ -2,6 +2,7 @@ namespace Luracast\Restler\Format; use Luracast\Restler\RestException; +use ProcessMaker\Validation\ValidationUploadedFiles; /** * Extending UploadFormat Support for Multi Part Form Data and File Uploads @@ -84,8 +85,21 @@ class UploadFormat extends Format throw new RestException(500, 'UploadFormat is read only'); } + /** + * Decode request. + * + * @param mixed $data + * @return array + * @throws RestException + * + * @see Luracast\Restler\CommentParser->parseEmbeddedData() + */ public function decode($data) { + $runRulesForFileEmpty = ValidationUploadedFiles::getValidationUploadedFiles()->runRulesForFileEmpty(); + if ($runRulesForFileEmpty->fails()) { + throw new RestException($runRulesForFileEmpty->getStatus(), $runRulesForFileEmpty->getMessage()); + } $doMimeCheck = !empty(self::$allowedMimeTypes); $doSizeCheck = self::$maximumFileSize ? TRUE : FALSE; //validate diff --git a/framework/src/Maveriks/WebApplication.php b/framework/src/Maveriks/WebApplication.php index 8b93a5a28..d619ecb8d 100644 --- a/framework/src/Maveriks/WebApplication.php +++ b/framework/src/Maveriks/WebApplication.php @@ -3,6 +3,7 @@ namespace Maveriks; use Bootstrap; +use Exception; use G; use Illuminate\Foundation\Http\Kernel; use Luracast\Restler\Format\UploadFormat; @@ -426,6 +427,16 @@ class WebApplication ); } + /** + * Define constants, setup configuration and initialize Laravel + * + * @param string $workspace + * @return bool + * @throws Exception + * + * @see run() + * @see workflow/engine/bin/cli.php + */ public function loadEnvironment($workspace = "") { define("PATH_SEP", DIRECTORY_SEPARATOR); @@ -467,24 +478,11 @@ class WebApplication define("PATH_CONTROLLERS", PATH_CORE . "controllers" . PATH_SEP); define("PATH_SERVICES_REST", PATH_CORE . "services" . PATH_SEP . "rest" . PATH_SEP); - G::defineConstants(); - $arraySystemConfiguration = System::getSystemConfiguration(); - - ini_set('date.timezone', $arraySystemConfiguration['time_zone']); //Set Time Zone - // set include path - set_include_path( - PATH_CORE . PATH_SEPARATOR . - PATH_THIRDPARTY . PATH_SEPARATOR . - PATH_THIRDPARTY . "pear" . PATH_SEPARATOR . - PATH_RBAC_CORE . PATH_SEPARATOR . - get_include_path() - ); - /* * Setting Up Workspace */ if (!file_exists(FILE_PATHS_INSTALLED)) { - throw new \Exception("Can't locate system file: " . FILE_PATHS_INSTALLED); + throw new Exception("Can't locate system file: " . FILE_PATHS_INSTALLED); } // include the server installed configuration @@ -496,17 +494,58 @@ class WebApplication define("PATH_TEMPORAL", PATH_C . "dynEditor/"); define("PATH_DB", PATH_DATA . "sites" . PATH_SEP); + // set include path + set_include_path( + PATH_CORE . PATH_SEPARATOR . + PATH_THIRDPARTY . PATH_SEPARATOR . + PATH_THIRDPARTY . "pear" . PATH_SEPARATOR . + PATH_RBAC_CORE . PATH_SEPARATOR . + get_include_path() + ); + + G::defineConstants(); + + $arraySystemConfiguration = System::getSystemConfiguration('', '', $workspace); + + //In community version the default value is 0 + $_SESSION['__SYSTEM_UTC_TIME_ZONE__'] = (int)($arraySystemConfiguration['system_utc_time_zone']) == 1; + + define('DEBUG_SQL_LOG', $arraySystemConfiguration['debug_sql']); + define('DEBUG_TIME_LOG', $arraySystemConfiguration['debug_time']); + define('DEBUG_CALENDAR_LOG', $arraySystemConfiguration['debug_calendar']); + define('MEMCACHED_ENABLED', $arraySystemConfiguration['memcached']); + define('MEMCACHED_SERVER', $arraySystemConfiguration['memcached_server']); + define('SYS_SKIN', $arraySystemConfiguration['default_skin']); + define('DISABLE_DOWNLOAD_DOCUMENTS_SESSION_VALIDATION', $arraySystemConfiguration['disable_download_documents_session_validation']); + define('TIME_ZONE', + (isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__']) ? 'UTC' : $arraySystemConfiguration['time_zone']); + // Change storage path app()->useStoragePath(realpath(PATH_DATA)); app()->make(Kernel::class)->bootstrap(); restore_error_handler(); error_reporting(error_reporting() & ~E_STRICT & ~E_DEPRECATED); + //Overwrite with the Processmaker env.ini configuration used in production environments + //@todo: move env.ini configuration to .env + ini_set('display_errors', $arraySystemConfiguration['display_errors']); + ini_set('error_reporting', $arraySystemConfiguration['error_reporting']); + ini_set('short_open_tag', 'On'); //?? + ini_set('default_charset', 'UTF-8'); //?? + ini_set('memory_limit', $arraySystemConfiguration['memory_limit']); + ini_set('soap.wsdl_cache_enabled', $arraySystemConfiguration['wsdl_cache']); + ini_set('date.timezone', TIME_ZONE); //Set Time Zone + + date_default_timezone_set(TIME_ZONE); + + config(['app.timezone' => TIME_ZONE]); + Bootstrap::setLanguage(); Bootstrap::LoadTranslationObject((defined("SYS_LANG")) ? SYS_LANG : "en"); if (empty($workspace)) { + // If the workspace is empty the function should be return the control to the previous file return true; } @@ -520,24 +559,6 @@ class WebApplication exit(0); } - $arraySystemConfiguration = System::getSystemConfiguration('', '', config("system.workspace")); - - //Do not change any of these settings directly, use env.ini instead - ini_set('display_errors', $arraySystemConfiguration['display_errors']); - ini_set('error_reporting', $arraySystemConfiguration['error_reporting']); - ini_set('short_open_tag', 'On'); //?? - ini_set('default_charset', 'UTF-8'); //?? - ini_set('memory_limit', $arraySystemConfiguration['memory_limit']); - ini_set('soap.wsdl_cache_enabled', $arraySystemConfiguration['wsdl_cache']); - - define('DEBUG_SQL_LOG', $arraySystemConfiguration['debug_sql']); - define('DEBUG_TIME_LOG', $arraySystemConfiguration['debug_time']); - define('DEBUG_CALENDAR_LOG', $arraySystemConfiguration['debug_calendar']); - define('MEMCACHED_ENABLED', $arraySystemConfiguration['memcached']); - define('MEMCACHED_SERVER', $arraySystemConfiguration['memcached_server']); - define('SYS_SKIN', $arraySystemConfiguration['default_skin']); - define('DISABLE_DOWNLOAD_DOCUMENTS_SESSION_VALIDATION', $arraySystemConfiguration['disable_download_documents_session_validation']); - require_once(PATH_DB . config("system.workspace") . "/db.php"); // defining constant for workspace shared directory @@ -591,17 +612,6 @@ class WebApplication \Propel::init(PATH_CONFIG . "databases.php"); - //Set Time Zone - /*----------------------------------********---------------------------------*/ - if (\PMLicensedFeatures::getSingleton()->verifyfeature('oq3S29xemxEZXJpZEIzN01qenJUaStSekY4cTdJVm5vbWtVM0d4S2lJSS9qUT0=')) { - $_SESSION['__SYSTEM_UTC_TIME_ZONE__'] = (int) ($arraySystemConfiguration['system_utc_time_zone']) == 1; - } - /*----------------------------------********---------------------------------*/ - - ini_set('date.timezone', (isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__']) ? 'UTC' : $arraySystemConfiguration['time_zone']); //Set Time Zone - - define('TIME_ZONE', ini_get('date.timezone')); - $oPluginRegistry = PluginRegistry::loadSingleton(); $attributes = $oPluginRegistry->getAttributes(); Bootstrap::LoadTranslationPlugins(defined('SYS_LANG') ? SYS_LANG : "en", $attributes); @@ -626,7 +636,7 @@ class WebApplication } return (isset($arrayConfig["api"]["version"]))? $arrayConfig["api"]["version"] : "1.0"; - } catch (\Exception $e) { + } catch (Exception $e) { throw $e; } } diff --git a/thirdparty/creole/drivers/mysqli/MySQLiResultSet.php b/thirdparty/creole/drivers/mysqli/MySQLiResultSet.php index fecfd6361..32a9ddaac 100644 --- a/thirdparty/creole/drivers/mysqli/MySQLiResultSet.php +++ b/thirdparty/creole/drivers/mysqli/MySQLiResultSet.php @@ -98,7 +98,9 @@ class MySQLiResultSet extends ResultSetCommon implements ResultSet { */ public function close() { - @mysqli_free_result($this->result); + if (is_resource($this->result)) { + @mysqli_free_result($this->result); + } $this->fields = array(); } diff --git a/thirdparty/pear/DB/mysqli.php b/thirdparty/pear/DB/mysqli.php index 3c0fd1db4..7bd138855 100644 --- a/thirdparty/pear/DB/mysqli.php +++ b/thirdparty/pear/DB/mysqli.php @@ -379,7 +379,13 @@ class DB_mysqli extends DB_common # need to come up with different means for next line # since $result is object (int)$result won't fly... // unset($this->num_rows[(int)$result]); - return @mysqli_free_result($result); + + //for compatibility the method must return a boolean. + if (is_resource($result)) { + @mysqli_free_result($result); + return true; + } + return false; } // }}} @@ -902,7 +908,9 @@ class DB_mysqli extends DB_common // free the result only if we were called on a table if ($got_string) { - @mysqli_free_result($id); + if (is_resource($id)) { + @mysqli_free_result($id); + } } return $res; } diff --git a/workflow/engine/bin/cron.php b/workflow/engine/bin/cron.php index 73f7dac89..5aa50b485 100644 --- a/workflow/engine/bin/cron.php +++ b/workflow/engine/bin/cron.php @@ -90,6 +90,9 @@ try { $e_all = (defined('E_STRICT'))? $e_all & ~E_STRICT : $e_all; $e_all = ($arraySystemConfiguration['debug'])? $e_all : $e_all & ~E_NOTICE; + //In community version the default value is 0 + $systemUtcTimeZone = (int)($arraySystemConfiguration['system_utc_time_zone']) == 1; + app()->useStoragePath(realpath(PATH_DATA)); app()->make(Kernel::class)->bootstrap(); restore_error_handler(); @@ -100,14 +103,18 @@ try { ini_set('default_charset', 'UTF-8'); ini_set('memory_limit', $arraySystemConfiguration['memory_limit']); ini_set('soap.wsdl_cache_enabled', $arraySystemConfiguration['wsdl_cache']); - ini_set('date.timezone', $arraySystemConfiguration['time_zone']); + ini_set('date.timezone', $systemUtcTimeZone ? 'UTC' : $arraySystemConfiguration['time_zone']); - define('DEBUG_SQL_LOG', $arraySystemConfiguration['debug_sql']); + define('DEBUG_SQL_LOG', $arraySystemConfiguration['debug_sql']); define('DEBUG_TIME_LOG', $arraySystemConfiguration['debug_time']); define('DEBUG_CALENDAR_LOG', $arraySystemConfiguration['debug_calendar']); - define('MEMCACHED_ENABLED', $arraySystemConfiguration['memcached']); - define('MEMCACHED_SERVER', $arraySystemConfiguration['memcached_server']); - define('TIME_ZONE', ini_get('date.timezone')); + define('MEMCACHED_ENABLED', $arraySystemConfiguration['memcached']); + define('MEMCACHED_SERVER', $arraySystemConfiguration['memcached_server']); + define('TIME_ZONE', ini_get('date.timezone')); + + date_default_timezone_set(TIME_ZONE); + + config(['app.timezone' => TIME_ZONE]); //CRON command options $arrayCommandOption = [ @@ -162,9 +169,7 @@ try { try { $cronSinglePath = PATH_CORE . 'bin' . PATH_SEP . 'cron_single.php'; - $workspace = ''; - $dateSystem = date('Y-m-d H:i:s'); $date = ''; $argvx = ''; @@ -192,8 +197,6 @@ try { if (!empty($date) && preg_match('/^' . '[1-9]\d{3}\-(?:0[1-9]|1[0-2])\-(?:0[1-9]|[12][0-9]|3[01])' . '(?:\s' . '(?:[0-1]\d|2[0-3])\:[0-5]\d\:[0-5]\d' . ')?$/', $date)) { eprintln('[Applying date filter: ' . $date . ']'); - } else { - $date = $dateSystem; } $counterw = 0; @@ -207,7 +210,7 @@ try { if (file_exists(PATH_DB . $entry . PATH_SEP . 'db.php')) { $counterw++; - passthru('php -f "' . $cronSinglePath . '" "' . base64_encode(PATH_HOME) . '" "' . base64_encode(PATH_TRUNK) . '" "' . base64_encode(PATH_OUTTRUNK) . '" ' . $cronName . ' ' . $entry . ' "' . $dateSystem . '" "' . $date . '" ' . $argvx); + passthru('php -f "' . $cronSinglePath . '" "' . base64_encode(PATH_HOME) . '" "' . base64_encode(PATH_TRUNK) . '" "' . base64_encode(PATH_OUTTRUNK) . '" ' . $cronName . ' ' . $entry . ' "' . $date . '" ' . $argvx); } } } @@ -219,7 +222,7 @@ try { $counterw++; - passthru('php -f "' . $cronSinglePath . '" "' . base64_encode(PATH_HOME) . '" "' . base64_encode(PATH_TRUNK) . '" "' . base64_encode(PATH_OUTTRUNK) . '" ' . $cronName . ' ' . $workspace . ' "' . $dateSystem . '" "' . $date . '" ' . $argvx); + passthru('php -f "' . $cronSinglePath . '" "' . base64_encode(PATH_HOME) . '" "' . base64_encode(PATH_TRUNK) . '" "' . base64_encode(PATH_OUTTRUNK) . '" ' . $cronName . ' ' . $workspace . ' "' . $date . '" ' . $argvx); } eprintln('Finished ' . $counterw . ' workspaces processed'); diff --git a/workflow/engine/bin/cron_single.php b/workflow/engine/bin/cron_single.php index 0bca4967c..9e63e3da3 100644 --- a/workflow/engine/bin/cron_single.php +++ b/workflow/engine/bin/cron_single.php @@ -34,7 +34,7 @@ ini_set('memory_limit', '512M'); try { //Verify data - if (count($argv) < 8) { + if (count($argv) < 7) { throw new Exception('Error: Invalid number of arguments'); } @@ -54,8 +54,7 @@ try { $pathOutTrunk = $argv[3]; $cronName = $argv[4]; $workspace = $argv[5]; - $dateSystem = $argv[6]; - $sNow = $argv[7]; //date + $now = $argv[6]; //date //Defines constants define('PATH_SEP', ($osIsLinux) ? '/' : '\\'); @@ -87,6 +86,9 @@ try { $e_all = (defined('E_STRICT')) ? $e_all & ~E_STRICT : $e_all; $e_all = ($arraySystemConfiguration['debug']) ? $e_all : $e_all & ~E_NOTICE; + //In community version the default value is 0 + $_SESSION['__SYSTEM_UTC_TIME_ZONE__'] = (int)($arraySystemConfiguration['system_utc_time_zone']) == 1; + app()->useStoragePath(realpath(PATH_DATA)); app()->make(Kernel::class)->bootstrap(); restore_error_handler(); @@ -96,13 +98,18 @@ try { ini_set('short_open_tag', 'On'); ini_set('default_charset', 'UTF-8'); ini_set('soap.wsdl_cache_enabled', $arraySystemConfiguration['wsdl_cache']); - ini_set('date.timezone', $arraySystemConfiguration['time_zone']); + ini_set('date.timezone', $_SESSION['__SYSTEM_UTC_TIME_ZONE__'] ? 'UTC' : $arraySystemConfiguration['time_zone']); define('DEBUG_SQL_LOG', $arraySystemConfiguration['debug_sql']); define('DEBUG_TIME_LOG', $arraySystemConfiguration['debug_time']); define('DEBUG_CALENDAR_LOG', $arraySystemConfiguration['debug_calendar']); define('MEMCACHED_ENABLED', $arraySystemConfiguration['memcached']); define('MEMCACHED_SERVER', $arraySystemConfiguration['memcached_server']); + define('TIME_ZONE', ini_get('date.timezone')); + + date_default_timezone_set(TIME_ZONE); + + config(['app.timezone' => TIME_ZONE]); spl_autoload_register(['Bootstrap', 'autoloadClass']); @@ -234,23 +241,9 @@ try { define('SYS_SKIN', $conf->getConfiguration('SKIN_CRON', '')); } - //Set Time Zone - $systemUtcTimeZone = false; - - /*----------------------------------********---------------------------------*/ - if (PMLicensedFeatures::getSingleton()->verifyfeature('oq3S29xemxEZXJpZEIzN01qenJUaStSekY4cTdJVm5vbWtVM0d4S2lJSS9qUT0=')) { - $systemUtcTimeZone = (int) ($arraySystemConfiguration['system_utc_time_zone']) == 1; - } - /*----------------------------------********---------------------------------*/ - - ini_set('date.timezone', ($systemUtcTimeZone) ? 'UTC' : $arraySystemConfiguration['time_zone']); //Set Time Zone - - define('TIME_ZONE', ini_get('date.timezone')); - - //UTC time zone - if ($systemUtcTimeZone) { - $sNow = convertToSystemUtcTimeZone($sNow); - $dateSystem = convertToSystemUtcTimeZone($dateSystem); + $dateSystem = date('Y-m-d H:i:s'); + if (empty($now)) { + $now = $dateSystem; } //Processing @@ -280,7 +273,7 @@ try { case 'timereventcron': $timerEvent = new \ProcessMaker\BusinessModel\TimerEvent(); - $timerEvent->startContinueCaseByTimerEvent($sNow, true); + $timerEvent->startContinueCaseByTimerEvent($now, true); break; case 'sendnotificationscron': sendNotifications(); @@ -343,7 +336,7 @@ function processWorkspace() function resendEmails() { global $argvx; - global $sNow; + global $now; global $dateSystem; if ($argvx != "" && strpos($argvx, "emails") === false) { @@ -353,9 +346,9 @@ function resendEmails() setExecutionMessage("Resending emails"); try { - $dateResend = $sNow; + $dateResend = $now; - if ($sNow == $dateSystem) { + if ($now == $dateSystem) { $arrayDateSystem = getdate(strtotime($dateSystem)); $mktDateSystem = mktime( @@ -408,7 +401,7 @@ function resendEmails() function unpauseApplications() { global $argvx; - global $sNow; + global $now; if ($argvx != "" && strpos($argvx, "unpause") === false) { return false; @@ -418,7 +411,7 @@ function unpauseApplications() try { $oCases = new Cases(); - $oCases->ThrowUnpauseDaemon($sNow, 1); + $oCases->ThrowUnpauseDaemon($now, 1); setExecutionResultMessage('DONE'); saveLog('unpauseApplications', 'action', 'Unpausing Applications'); @@ -552,10 +545,10 @@ function calculateAppDuration() } /*----------------------------------********---------------------------------*/ -function executeEvents($sLastExecution, $sNow = null) +function executeEvents($sLastExecution, $now = null) { global $argvx; - global $sNow; + global $now; $log = array(); @@ -568,15 +561,15 @@ function executeEvents($sLastExecution, $sNow = null) try { $oAppEvent = new AppEvent(); - saveLog('executeEvents', 'action', "Executing Events $sLastExecution, $sNow "); - $n = $oAppEvent->executeEvents($sNow, false, $log, 1); + saveLog('executeEvents', 'action', "Executing Events $sLastExecution, $now "); + $n = $oAppEvent->executeEvents($now, false, $log, 1); foreach ($log as $value) { $arrayCron = unserialize(trim(@file_get_contents(PATH_DATA . "cron"))); $arrayCron["processcTimeStart"] = time(); @file_put_contents(PATH_DATA . "cron", serialize($arrayCron)); - saveLog('executeEvents', 'action', "Execute Events : $value, $sNow "); + saveLog('executeEvents', 'action', "Execute Events : $value, $now "); } setExecutionMessage("|- End Execution events"); @@ -588,11 +581,11 @@ function executeEvents($sLastExecution, $sNow = null) } } -function executeScheduledCases($sNow = null) +function executeScheduledCases($now = null) { try { global $argvx; - global $sNow; + global $now; $log = array(); if ($argvx != "" && strpos($argvx, "scheduler") === false) { @@ -603,7 +596,7 @@ function executeScheduledCases($sNow = null) setExecutionResultMessage('PROCESSING'); $oCaseScheduler = new CaseScheduler(); - $oCaseScheduler->caseSchedulerCron($sNow, $log, 1); + $oCaseScheduler->caseSchedulerCron($now, $log, 1); foreach ($log as $value) { $arrayCron = unserialize(trim(@file_get_contents(PATH_DATA . "cron"))); @@ -620,35 +613,6 @@ function executeScheduledCases($sNow = null) } } -function convertToSystemUtcTimeZone($sNow) -{ - global $arraySystemConfiguration; - - $runDate = isset($sNow) ? $sNow : date('Y-m-d H:i:s'); - - $systemUtcTimeZone = false; - /*----------------------------------********---------------------------------*/ - if (PMLicensedFeatures::getSingleton()->verifyfeature('oq3S29xemxEZXJpZEIzN01qenJUaStSekY4cTdJVm5vbWtVM0d4S2lJSS9qUT0=')) { - $systemUtcTimeZone = (int) ($arraySystemConfiguration['system_utc_time_zone']) == 1; - } - /*----------------------------------********---------------------------------*/ - - if ($systemUtcTimeZone) { - if (isset($sNow)) { - //as the $sNow param that comes from the command line doesn't specicy a time zone - //we assume that the user set this time using the server time zone so we use the gmdate - //function to convert it - $currentTimeZone = date_default_timezone_get(); - date_default_timezone_set($arraySystemConfiguration['time_zone']); - $runDate = gmdate('Y-m-d H:i:s', strtotime($sNow)); - date_default_timezone_set($currentTimeZone); - } else { - $runDate = gmdate('Y-m-d H:i:s'); - } - } - return $runDate; -} - function executeUpdateAppTitle() { try { diff --git a/workflow/engine/classes/Cases.php b/workflow/engine/classes/Cases.php index d935ba9b2..3f9738331 100644 --- a/workflow/engine/classes/Cases.php +++ b/workflow/engine/classes/Cases.php @@ -7514,5 +7514,183 @@ class Cases $caseDataRow["USR_UID"] = $targetUserId; $listInbox->create($caseDataRow); } + + /** + * Obtains the task information and the user delegated to the task for an specific case + * + * @param string $applicationUid + * @param string $processUid + * + * @see /workflow/engine/src/ProcessMaker/BusinessModel/Cases::getTasks($applicationUid) + * + * @return ResultSet + * @throws Exception + * + */ + public function getTasksInfoForACase($applicationUid, $processUid) + { + $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 + WHERE TASK.PRO_UID = ?'; + + $stmt = $conn->prepareStatement($sql); + + $stmt->set(1, $applicationUid); + $stmt->set(2, $applicationUid); + $stmt->set(3, $processUid); + + if (!$stmt->executeQuery()) { + throw Exception(G::LoadTranslation('ID_MSG_AJAX_FAILURE')); + } + + return $stmt->getResultSet(); + } + + /** + * Get the task information when the task is a sub-process + * + * @param string $processUid + * @param string $tasUid + * + * @see /workflow/engine/src/ProcessMaker/BusinessModel/Cases::getTasks($applicationUid) + * + * @return ResultSet + */ + public function getTaskInfoForSubProcess($processUid, $tasUid) + { + $criteria = new Criteria("workflow"); + + $criteria->addSelectColumn(SubProcessPeer::PRO_UID); + $criteria->addSelectColumn(TaskPeer::TAS_TITLE); + $criteria->addSelectColumn(TaskPeer::TAS_DESCRIPTION); + $criteria->addJoin(SubProcessPeer::TAS_PARENT, TaskPeer::TAS_UID, Criteria::LEFT_JOIN); + $criteria->add(SubProcessPeer::PRO_PARENT, $processUid); + $criteria->add(SubProcessPeer::TAS_PARENT, $tasUid); + + $rsCriteria = SubProcessPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); + + return $rsCriteria; + } + + /** + * Get the routes of a task + * + * @param string $processUid + * @param string $tasUid + * + * @see /workflow/engine/src/ProcessMaker/BusinessModel/Cases::getTasks($applicationUid) + * + * @return ResultSet + */ + public function getTaskRoutes($processUid, $tasUid) + { + $criteria = new Criteria("workflow"); + + $criteria->addAsColumn("ROU_NUMBER", RoutePeer::ROU_CASE); + $criteria->addSelectColumn(RoutePeer::ROU_TYPE); + $criteria->addSelectColumn(RoutePeer::ROU_CONDITION); + $criteria->addAsColumn("TAS_UID", RoutePeer::ROU_NEXT_TASK); + $criteria->add(RoutePeer::PRO_UID, $processUid, Criteria::EQUAL); + $criteria->add(RoutePeer::TAS_UID, $tasUid, Criteria::EQUAL); + $criteria->addAscendingOrderByColumn("ROU_NUMBER"); + + $rsCriteria = RoutePeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); + + return $rsCriteria; + } + + /** + * Get the delegations of an specific case + * + * @param string $applicationUid + * @param string $tasUid + * + * @see /workflow/engine/src/ProcessMaker/BusinessModel/Cases::getTasks($applicationUid) + * + * @return ResultSet + */ + public function getCaseDelegations($applicationUid, $tasUid) + { + $criteria = new Criteria("workflow"); + + $criteria->addSelectColumn(AppDelegationPeer::DEL_INDEX); + $criteria->addSelectColumn(AppDelegationPeer::DEL_DELEGATE_DATE); + $criteria->addSelectColumn(AppDelegationPeer::DEL_INIT_DATE); + $criteria->addSelectColumn(AppDelegationPeer::DEL_TASK_DUE_DATE); + $criteria->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE); + $criteria->addSelectColumn(UsersPeer::USR_UID); + $criteria->addSelectColumn(UsersPeer::USR_USERNAME); + $criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME); + $criteria->addSelectColumn(UsersPeer::USR_LASTNAME); + + $criteria->addJoin(AppDelegationPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN); + + $criteria->add(AppDelegationPeer::APP_UID, $applicationUid, Criteria::EQUAL); + $criteria->add(AppDelegationPeer::TAS_UID, $tasUid, Criteria::EQUAL); + $criteria->addAscendingOrderByColumn(AppDelegationPeer::DEL_INDEX); + + $rsCriteria = AppDelegationPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); + + return $rsCriteria; + } + + /** + * Get the total amount and the minimun date of the Delegation table for an specific case + * + * @param string $applicationUid + * @param string $tasUid + * + * @see /workflow/engine/src/ProcessMaker/BusinessModel/Cases::getTasks($applicationUid) + * + * @return ResultSet + */ + public function getTotalAndMinDateForACase($applicationUid, $tasUid) + { + $criteria = new Criteria("workflow"); + + $criteria->addAsColumn("CANT", "COUNT(" . AppDelegationPeer::APP_UID . ")"); + $criteria->addAsColumn("FINISH", "MIN(" . AppDelegationPeer::DEL_FINISH_DATE . ")"); + $criteria->add(AppDelegationPeer::APP_UID, $applicationUid, Criteria::EQUAL); + $criteria->add(AppDelegationPeer::TAS_UID, $tasUid, Criteria::EQUAL); + + $rsCriteria = AppDelegationPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); + + return $rsCriteria; + } + + /** + * Get the DEL_FINISH_DATE of the Delegation table of an specific task in a case + * + * @param string $applicationUid + * @param string $tasUid + * + * @see /workflow/engine/src/ProcessMaker/BusinessModel/Cases::getTasks($applicationUid) + * + * @return ResultSet + */ + public function getDelegationFinishDate($applicationUid, $tasUid) + { + $criteria = new Criteria("workflow"); + + $criteria->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE); + $criteria->add(AppDelegationPeer::APP_UID, $applicationUid, Criteria::EQUAL); + $criteria->add(AppDelegationPeer::TAS_UID, $tasUid, Criteria::EQUAL); + $criteria->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL); + + $rsCriteria = AppDelegationPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); + + return $rsCriteria; + } } diff --git a/workflow/engine/classes/class.webdav.php b/workflow/engine/classes/class.webdav.php index 4fd290379..d4d9503d6 100644 --- a/workflow/engine/classes/class.webdav.php +++ b/workflow/engine/classes/class.webdav.php @@ -944,6 +944,8 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server * * @param string resource path to check for locks * @return bool true on success + * @link https://wiki.processmaker.com/index.php/WebDAV + * @deprecated */ public function checkLock($path) { @@ -959,7 +961,9 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server if ($res) { $row = mysqli_fetch_array($res); - mysqli_free_result($res); + if (is_resource($res)) { + mysqli_free_result($res); + } if ($row) { $result = array("type" => "write", "scope" => $row["exclusivelock"] ? "exclusive" : "shared", "depth" => 0, "owner" => $row['owner'], "token" => $row['token'], "expires" => $row['expires'] diff --git a/workflow/engine/content/translations/english/processmaker.en.po b/workflow/engine/content/translations/english/processmaker.en.po index 6ea5d71df..5f4ca981b 100644 --- a/workflow/engine/content/translations/english/processmaker.en.po +++ b/workflow/engine/content/translations/english/processmaker.en.po @@ -15269,6 +15269,12 @@ msgstr "Screenshot640" msgid "The input document is required, please select the value." msgstr "The input document is required, please select the value." +# TRANSLATION +# LABEL/ID_MAFE_99567b953da8beace4e3e7296bf1fc23 +#: LABEL/ID_MAFE_99567b953da8beace4e3e7296bf1fc23 +msgid "Assign type" +msgstr "Assign type" + # TRANSLATION # LABEL/ID_MAFE_99b2439e63f73ad515f7ab2447a80673 #: LABEL/ID_MAFE_99b2439e63f73ad515f7ab2447a80673 @@ -15653,6 +15659,12 @@ msgstr "Ok" msgid "Notify the assigned user to this task" msgstr "Notify the assigned user to this task" +# TRANSLATION +# LABEL/ID_MAFE_a6122a65eaa676f700ae68d393054a37 +#: LABEL/ID_MAFE_a6122a65eaa676f700ae68d393054a37 +msgid "Start" +msgstr "Start" + # TRANSLATION # LABEL/ID_MAFE_a6527af0da63377b07a3effae750a485 #: LABEL/ID_MAFE_a6527af0da63377b07a3effae750a485 @@ -16475,6 +16487,12 @@ msgstr "Invalid Connection between elements" msgid "Invalid operation: Delete message flow before converting it to" msgstr "Invalid operation: Delete message flow before converting it to" +# TRANSLATION +# LABEL/ID_MAFE_c5e54f7804fa817826dfa5ecc13cd92f +#: LABEL/ID_MAFE_c5e54f7804fa817826dfa5ecc13cd92f +msgid "Last User Name" +msgstr "Last User Name" + # TRANSLATION # LABEL/ID_MAFE_c5f93fd19468533ea5c9114801c2958d #: LABEL/ID_MAFE_c5f93fd19468533ea5c9114801c2958d @@ -17327,6 +17345,12 @@ msgstr "Select a Control" msgid "Please configure script to wait for a signal." msgstr "Please configure script to wait for a signal." +# TRANSLATION +# LABEL/ID_MAFE_e2ac1703ae8a4bb8b146f7337a7e4cab +#: LABEL/ID_MAFE_e2ac1703ae8a4bb8b146f7337a7e4cab +msgid "Last User" +msgstr "Last User" + # TRANSLATION # LABEL/ID_MAFE_e2b9d6eb9f3ec7d4e6089274a4481fab #: LABEL/ID_MAFE_e2b9d6eb9f3ec7d4e6089274a4481fab @@ -17807,6 +17831,12 @@ msgstr "Assignment" msgid "EXCLUSIVE" msgstr "EXCLUSIVE" +# TRANSLATION +# LABEL/ID_MAFE_f45fabda0c6a595f709b3996398132f5 +#: LABEL/ID_MAFE_f45fabda0c6a595f709b3996398132f5 +msgid "Diverging gateways expect to receive only one incoming flow." +msgstr "Diverging gateways expect to receive only one incoming flow." + # TRANSLATION # LABEL/ID_MAFE_f4636507ca93332f92f92fb219a43b02 #: LABEL/ID_MAFE_f4636507ca93332f92f92fb219a43b02 @@ -24971,6 +25001,18 @@ msgstr "Error: The application {0} is not canceled." msgid "The default configuration was not defined" msgstr "The default configuration was not defined" +# TRANSLATION +# LABEL/ID_THE_FILE_SIZE_IS_BIGGER_THAN_THE_MAXIMUM_ALLOWED +#: LABEL/ID_THE_FILE_SIZE_IS_BIGGER_THAN_THE_MAXIMUM_ALLOWED +msgid "The file size is bigger than the maximum allowed, the maximum size allowed is {0} Mbytes." +msgstr "The file size is bigger than the maximum allowed, the maximum size allowed is {0} Mbytes." + +# TRANSLATION +# LABEL/ID_THE_MAXIMUM_VALUE_OF_THIS_FIELD_IS +#: LABEL/ID_THE_MAXIMUM_VALUE_OF_THIS_FIELD_IS +msgid "The maximum value of this field is {0}." +msgstr "The maximum value of this field is {0}." + # TRANSLATION # LABEL/ID_THE_MIMETYPE_EXTENSION_ERROR #: LABEL/ID_THE_MIMETYPE_EXTENSION_ERROR diff --git a/workflow/engine/controllers/designer.php b/workflow/engine/controllers/designer.php index 44772077b..8f5efd29f 100644 --- a/workflow/engine/controllers/designer.php +++ b/workflow/engine/controllers/designer.php @@ -11,9 +11,10 @@ use ProcessMaker\Plugins\PluginRegistry; */ use Maveriks\Util\ClassLoader; -use \OAuth2\Request; -use \ProcessMaker\BusinessModel\Light\Tracker; -use \ProcessMaker\Services\OAuth2\Server; +use OAuth2\Request; +use ProcessMaker\BusinessModel\InputDocument; +use ProcessMaker\BusinessModel\Light\Tracker; +use ProcessMaker\Services\OAuth2\Server; class Designer extends Controller { @@ -27,6 +28,8 @@ class Designer extends Controller * Index Action * * @param string $httpData (opional) + * + * @see Controller->call() */ public function index($httpData) { @@ -65,6 +68,8 @@ class Designer extends Controller $this->setVar("SYS_LANG", SYS_LANG); $this->setVar("SYS_SKIN", SYS_SKIN); $this->setVar('HTTP_SERVER_HOSTNAME', System::getHttpServerHostnameRequestsFrontEnd()); + $inpuDocument = new InputDocument(); + $this->setVar('maxFileSizeInformation', G::json_encode($inpuDocument->getMaxFileSize())); if ($debug) { if (!file_exists(PATH_HTML . "lib-dev/pmUI/build.cache")) { diff --git a/workflow/engine/data/mysql/insert.sql b/workflow/engine/data/mysql/insert.sql index 9b02635e1..c7f2725a0 100644 --- a/workflow/engine/data/mysql/insert.sql +++ b/workflow/engine/data/mysql/insert.sql @@ -59397,6 +59397,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_9925fd3c9d09e862da22c5d6912420d9','en','End event must have an incoming sequence flow', NOW()) , ( 'LABEL','ID_MAFE_992d1d47106d77216cd6c3a15415dbea','en','Screenshot640', NOW()) , ( 'LABEL','ID_MAFE_99493c187e709deb387b6ee3ec6c8179','en','The input document is required, please select the value.', NOW()) , +( 'LABEL','ID_MAFE_99567b953da8beace4e3e7296bf1fc23','en','Assign type', NOW()) , ( 'LABEL','ID_MAFE_99b2439e63f73ad515f7ab2447a80673','en','PAUSED', NOW()) , ( 'LABEL','ID_MAFE_99c293babcada00063dd86b4f53bccd7','en','Variable sent in email', NOW()) , ( 'LABEL','ID_MAFE_9a0364b9e99bb480dd25e1f0284c8555','en','content', NOW()) , @@ -59462,6 +59463,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_a603905470e2a5b8c13e96b579ef0dba','en','Debug', NOW()) , ( 'LABEL','ID_MAFE_a60852f204ed8028c1c58808b746d115','en','Ok', NOW()) , ( 'LABEL','ID_MAFE_a60cf2ece5b3e294aa794916477ac6a8','en','Notify the assigned user to this task', NOW()) , +( 'LABEL','ID_MAFE_a6122a65eaa676f700ae68d393054a37','en','Start', NOW()) , ( 'LABEL','ID_MAFE_a6527af0da63377b07a3effae750a485','en','
Triggers: Create scripts.', NOW()) , ( 'LABEL','ID_MAFE_a6c0580005d36b8ad4194b3b31cdb9ee','en','Input Document deleted successfully', NOW()) , ( 'LABEL','ID_MAFE_a6ca4597da3795aed1b1fa92f0e8d9a6','en','Previous Decade', NOW()) , @@ -59603,6 +59605,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_c53385d51221bcb27c5f37de31043c24','en','No Category', NOW()) , ( 'LABEL','ID_MAFE_c5bcf625cbb751aba886be634ef4ef47','en','Invalid Connection between elements', NOW()) , ( 'LABEL','ID_MAFE_c5d84b6c19cb058b7b5471b30e926823','en','Invalid operation: Delete message flow before converting it to', NOW()) , +( 'LABEL','ID_MAFE_c5e54f7804fa817826dfa5ecc13cd92f','en','Last User Name', NOW()) , ( 'LABEL','ID_MAFE_c5f93fd19468533ea5c9114801c2958d','en','Input Document updated successfully', NOW()) , ( 'LABEL','ID_MAFE_c61404957758dfda283709e89376ab3e','en','layout', NOW()) , ( 'LABEL','ID_MAFE_c61dee25881b22ead46aca2bc70f0f9d','en','Assigned supervisors list', NOW()) , @@ -59747,6 +59750,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_e2627d9094274c7bcdc01ce1dadbaaab','en','Select Target Process', NOW()) , ( 'LABEL','ID_MAFE_e29d57981d438d31f08b968bb12ed568','en','Select a Control', NOW()) , ( 'LABEL','ID_MAFE_e2a990c9958b0fd2ecb860335737c258','en','Please configure script to wait for a signal.', NOW()) , +( 'LABEL','ID_MAFE_e2ac1703ae8a4bb8b146f7337a7e4cab','en','Last User', NOW()) , ( 'LABEL','ID_MAFE_e2b9d6eb9f3ec7d4e6089274a4481fab','en','There are problems getting the list of DynaForms, please try again.', NOW()) , ( 'LABEL','ID_MAFE_e30f555e5a24f076a5d5be70a4625270','en','TNS', NOW()) , ( 'LABEL','ID_MAFE_e3ce9b91bd7b1be415b5e687006ad179','en','false: No default selection
true: current date
year: the first day of the current year
month: the first day of the month
day: the current day
hour: the current hour without minutes
minute: the current minute', NOW()) , @@ -59829,6 +59833,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_f3a29486bed19a90f2da6d007818b427','en','Steps', NOW()) , ( 'LABEL','ID_MAFE_f3b92fc0f97f128818cfb44321376bca','en','Assignment', NOW()) , ( 'LABEL','ID_MAFE_f45c3a0bb3687ed8e221253b3fd4a2ce','en','EXCLUSIVE', NOW()) , +( 'LABEL','ID_MAFE_f45fabda0c6a595f709b3996398132f5','en','Diverging gateways expect to receive only one incoming flow.', NOW()) , ( 'LABEL','ID_MAFE_f4636507ca93332f92f92fb219a43b02','en','Database Connection', NOW()) , ( 'LABEL','ID_MAFE_f49b52022300199128ed01380edda751','en','There are problems updating the Timer Event, please try again.', NOW()) , ( 'LABEL','ID_MAFE_f4ae7ce97eda9edfe1541b3fdea115b6','en','Group or User', NOW()) , @@ -61051,6 +61056,8 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_THERE_PROBLEM_SENDING_EMAIL','en','There was a problem sending the email to','2016-04-08') , ( 'LABEL','ID_THE_APPLICATION_IS_NOT_CANCELED','en','Error: The application {0} is not canceled.','2016-06-15') , ( 'LABEL','ID_THE_DEFAULT_CONFIGURATION','en','The default configuration was not defined','2016-11-16') , +( 'LABEL','ID_THE_FILE_SIZE_IS_BIGGER_THAN_THE_MAXIMUM_ALLOWED','en','The file size is bigger than the maximum allowed, the maximum size allowed is {0} Mbytes.','2019-02-26') , +( 'LABEL','ID_THE_MAXIMUM_VALUE_OF_THIS_FIELD_IS','en','The maximum value of this field is {0}.','2019-02-26') , ( 'LABEL','ID_THE_MIMETYPE_EXTENSION_ERROR','en','The mime type does not correspond to the permitted extension, please verify your file.','2018-10-2') , ( 'LABEL','ID_THE_NAME_CHANGE_MAY_CAUSE_DATA_LOSS','en','The change might cause data loss in the PM table. Do you want to continue?','2017-03-30') , ( 'LABEL','ID_THE_PHP_FILES_EXECUTION_WAS_DISABLED','en','The PHP files execution was disabled please contact the system administrator.','2018-04-20') , diff --git a/workflow/engine/methods/cases/cases_Open.php b/workflow/engine/methods/cases/cases_Open.php index 8e79f67b2..bdba04b22 100644 --- a/workflow/engine/methods/cases/cases_Open.php +++ b/workflow/engine/methods/cases/cases_Open.php @@ -2,24 +2,17 @@ /** * cases_Open.php * - * ProcessMaker Open Source Edition - * Copyright (C) 2004 - 2008 Colosa Inc. + * @see cases/casesList.js + * @see cases/cases_Step.php + * @see cases/cases_CatchSelfService.php + * @see cases/derivatedGmail.php + * @see cases/open.php + * @see controllers/Home::indexSingle() + * @see controllers/Home::startCase() + * @see pmGmail/sso.php + * @see webentry/access.php * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. + * @link https://wiki.processmaker.com/3.2/Cases/Cases#Search_Criteria */ if(isset( $_GET['gmail']) && $_GET['gmail'] == 1){ @@ -50,7 +43,8 @@ try { //Loading data for a Jump request if (!isset($_GET['APP_UID']) && isset($_GET['APP_NUMBER'])) { $_GET['APP_UID'] = $caseInstance->getApplicationUIDByNumber( $_GET['APP_NUMBER'] ); - $_GET['DEL_INDEX'] = $caseInstance->getCurrentDelegation( $_GET['APP_UID'], $_SESSION['USER_LOGGED'] ); + //Get the index related to the userLogged but this thread can be OPEN or CLOSED + $_GET['DEL_INDEX'] = $caseInstance->getCurrentDelegation($_GET['APP_UID'], $_SESSION['USER_LOGGED']); //if the application doesn't exist if (is_null($_GET['APP_UID'])) { @@ -67,87 +61,86 @@ try { } } - $sAppUid = $_GET['APP_UID']; - $iDelIndex = $_GET['DEL_INDEX']; - $_action = isset($_GET['action']) ? $_GET['action'] : ''; + $appUid = $_GET['APP_UID']; + $delIndex = $_GET['DEL_INDEX']; + $action = isset($_GET['action']) ? $_GET['action'] : ''; //loading application data - $aFields = $caseInstance->loadCase( $sAppUid, $iDelIndex ); + $fieldCase = $caseInstance->loadCase($appUid, $delIndex); if (!isset($_SESSION['CURRENT_TASK'])) { - $_SESSION['CURRENT_TASK'] = $aFields['TAS_UID']; + $_SESSION['CURRENT_TASK'] = $fieldCase['TAS_UID']; } elseif ($_SESSION['CURRENT_TASK'] == '') { - $_SESSION['CURRENT_TASK'] = $aFields['TAS_UID']; + $_SESSION['CURRENT_TASK'] = $fieldCase['TAS_UID']; } unset($_SESSION['ACTION']); $flagJump = ''; - if ($_action == 'jump') { + if ($action == 'jump') { $_SESSION['ACTION'] = 'jump'; $flagJump = 1; } - switch ($aFields['APP_STATUS']) { + switch ($fieldCase['APP_STATUS']) { case 'DRAFT': case 'TO_DO': //Check if the case is in pause, check a valid record in table APP_DELAY - $isPaused = AppDelay::isPaused($sAppUid, $iDelIndex); + $isPaused = AppDelay::isPaused($appUid, $delIndex); //Check if the case is a waiting for a SYNCHRONOUS subprocess - $subAppData = new \SubApplication(); - $caseSubprocessPending = $subAppData->isSubProcessWithCasePending($sAppUid, $iDelIndex); + $subAppData = new SubApplication(); + $caseSubprocessPending = $subAppData->isSubProcessWithCasePending($appUid, $delIndex); if ($isPaused || $caseSubprocessPending) { //the case is paused show only the resume - $_SESSION['APPLICATION'] = $sAppUid; - $_SESSION['INDEX'] = $iDelIndex; - $_SESSION['PROCESS'] = $aFields['PRO_UID']; - $_SESSION['TASK'] = - 1; + $_SESSION['APPLICATION'] = $appUid; + $_SESSION['INDEX'] = $delIndex; + $_SESSION['PROCESS'] = $fieldCase['PRO_UID']; + $_SESSION['TASK'] = -1; $_SESSION['STEP_POSITION'] = 0; - $_SESSION['CURRENT_TASK'] = $aFields['TAS_UID']; + $_SESSION['CURRENT_TASK'] = $fieldCase['TAS_UID']; - require_once (PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php'); + require_once(PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php'); exit(); } /** * these routine is to verify if the case was acceded from advanced search list */ - - if ($_action == 'search') { + if ($action == 'search') { //verify if the case is with the current user - $aData = AppDelegation::getCurrentUsers($sAppUid, $iDelIndex); - if ($aData['USR_UID'] !== $_SESSION['USER_LOGGED'] && !empty($aData['USR_UID'])) { + $delegationUsers = AppDelegation::getCurrentUsers($appUid, $delIndex); + if ($delegationUsers['USR_UID'] !== $_SESSION['USER_LOGGED'] && !empty($delegationUsers['USR_UID'])) { //distinct "" for selfservice //so we show just the resume $_SESSION['alreadyDerivated'] = true; - $_SESSION['APPLICATION'] = $sAppUid; - $_SESSION['INDEX'] = $iDelIndex; - $_SESSION['PROCESS'] = $aFields['PRO_UID']; - $_SESSION['TASK'] = - 1; + $_SESSION['APPLICATION'] = $appUid; + $_SESSION['INDEX'] = $delIndex; + $_SESSION['PROCESS'] = $fieldCase['PRO_UID']; + $_SESSION['TASK'] = -1; $_SESSION['STEP_POSITION'] = 0; - require_once (PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php'); + require_once(PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php'); exit(); } } - //proceed and try to open the case - $oAppDelegation = new AppDelegation(); - $aDelegation = $oAppDelegation->load( $sAppUid, $iDelIndex ); + //Proceed and try to open the case + $appDelegation = new AppDelegation(); + $delegationInfo = $appDelegation->load($appUid, $delIndex); - //if there are no user in the delegation row, this case is in selfservice - if ($aDelegation['USR_UID'] == "") { - $_SESSION['APPLICATION'] = $sAppUid; - $_SESSION['INDEX'] = $iDelIndex; - $_SESSION['PROCESS'] = $aFields['PRO_UID']; - $_SESSION['TASK'] = - 1; + //If there are no user in the delegation row, this case is in selfservice + if (empty($delegationInfo['USR_UID'])) { + $_SESSION['APPLICATION'] = $appUid; + $_SESSION['INDEX'] = $delIndex; + $_SESSION['PROCESS'] = $fieldCase['PRO_UID']; + $_SESSION['TASK'] = -1; $_SESSION['STEP_POSITION'] = 0; - $_SESSION['CURRENT_TASK'] = $aFields['TAS_UID']; + $_SESSION['CURRENT_TASK'] = $fieldCase['TAS_UID']; - //if the task is in the valid selfservice tasks for this user, then catch the case, else just view the resume - if ($caseInstance->isSelfService($_SESSION['USER_LOGGED'], $aFields['TAS_UID'], $sAppUid)) { + //If the task is in the valid selfservice tasks for this user, then catch the case, else just view the resume + if ($caseInstance->isSelfService($_SESSION['USER_LOGGED'], $fieldCase['TAS_UID'], $appUid)) { require_once(PATH_METHODS . 'cases' . PATH_SEP . 'cases_CatchSelfService.php'); } else { require_once(PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php'); @@ -156,49 +149,56 @@ try { exit(); } - //If the current users is in the AppDelegation row, then open the case - if (($aDelegation['USR_UID'] == $_SESSION['USER_LOGGED']) && $_action != 'sent') { - $_SESSION['APPLICATION'] = $sAppUid; - $_SESSION['INDEX'] = $iDelIndex; + //If the current users is in the AppDelegation row and the thread is open will be open the case + if (($delegationInfo['USR_UID'] == $_SESSION['USER_LOGGED'] && $delegationInfo['DEL_THREAD_STATUS'] === 'OPEN') + && $action != 'sent') + { + $_SESSION['APPLICATION'] = $appUid; + $_SESSION['INDEX'] = $delIndex; - if (is_null( $aFields['DEL_INIT_DATE'] )) { - $caseInstance->setDelInitDate( $sAppUid, $iDelIndex ); - $aFields = $caseInstance->loadCase( $sAppUid, $iDelIndex ); + if (is_null($fieldCase['DEL_INIT_DATE'])) { + $caseInstance->setDelInitDate($appUid, $delIndex); + $fieldCase = $caseInstance->loadCase($appUid, $delIndex); } - $_SESSION['PROCESS'] = $aFields['PRO_UID']; - $_SESSION['TASK'] = $aFields['TAS_UID']; + $_SESSION['PROCESS'] = $fieldCase['PRO_UID']; + $_SESSION['TASK'] = $fieldCase['TAS_UID']; $_SESSION['STEP_POSITION'] = 0; /* Redirect to next step */ - unset( $_SESSION['bNoShowSteps'] ); + unset($_SESSION['bNoShowSteps']); - /* Execute Before Triggers for first Task*/ - $caseInstance->getExecuteTriggerProcess($sAppUid, 'OPEN'); - /*end Execute Before Triggers for first Task*/ + /** Execute a trigger when a case is open */ + $caseInstance->getExecuteTriggerProcess($appUid, 'OPEN'); - $aNextStep = $caseInstance->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] ); - $sPage = $aNextStep['PAGE']; - G::header( 'location: ' . $sPage ); + $nextStep = $caseInstance->getNextStep( + $_SESSION['PROCESS'], + $_SESSION['APPLICATION'], + $_SESSION['INDEX'], + $_SESSION['STEP_POSITION'] + ); + $pageOpenCase = $nextStep['PAGE']; + + G::header('location: ' . $pageOpenCase); } else { - $_SESSION['APPLICATION'] = $sAppUid; - $_SESSION['PROCESS'] = $aFields['PRO_UID']; - $_SESSION['TASK'] = - 1; + $_SESSION['APPLICATION'] = $appUid; + $_SESSION['PROCESS'] = $fieldCase['PRO_UID']; + $_SESSION['TASK'] = -1; $_SESSION['bNoShowSteps'] = 1; $_SESSION['STEP_POSITION'] = 0; //When the case have another user or current user doesn't have rights to this self-service, //Just view the case Resume - if ($_action === 'search' || $_action === 'to_reassign') { + if ($action === 'search' || $action === 'to_reassign') { //We need to use the index sent with the corresponding record - $_SESSION['INDEX'] = $iDelIndex; + $_SESSION['INDEX'] = $delIndex; } else { //Get DEL_INDEX $criteria = new Criteria('workflow'); $criteria->addSelectColumn(AppDelegationPeer::DEL_INDEX); - $criteria->add(AppDelegationPeer::APP_UID, $sAppUid); - $criteria->add(AppDelegationPeer::DEL_LAST_INDEX , 1); + $criteria->add(AppDelegationPeer::APP_UID, $appUid); + $criteria->add(AppDelegationPeer::DEL_LAST_INDEX, 1); $rs = AppDelegationPeer::doSelectRS($criteria); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rs->next(); @@ -206,29 +206,29 @@ try { $_SESSION['INDEX'] = $row['DEL_INDEX']; } - $Fields = $caseInstance->loadCase($_SESSION['APPLICATION'], $_SESSION['INDEX'], $flagJump); + $fields = $caseInstance->loadCase($_SESSION['APPLICATION'], $_SESSION['INDEX'], $flagJump); + $_SESSION['CURRENT_TASK'] = $fields['TAS_UID']; - $_SESSION['CURRENT_TASK'] = $Fields['TAS_UID']; - require_once (PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php'); + require_once(PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php'); } break; default: //APP_STATUS IS COMPLETED OR CANCELLED - $_SESSION['APPLICATION'] = $sAppUid; - $_SESSION['INDEX'] = $caseInstance->getCurrentDelegationCase( $_GET['APP_UID'] ); - $_SESSION['PROCESS'] = $aFields['PRO_UID']; - $_SESSION['TASK'] = - 1; + $_SESSION['APPLICATION'] = $appUid; + $_SESSION['INDEX'] = $caseInstance->getCurrentDelegationCase($_GET['APP_UID']); + $_SESSION['PROCESS'] = $fieldCase['PRO_UID']; + $_SESSION['TASK'] = -1; $_SESSION['STEP_POSITION'] = 0; - $Fields = $caseInstance->loadCase($_SESSION['APPLICATION'], $_SESSION['INDEX'], $flagJump); - $_SESSION['CURRENT_TASK'] = $Fields['TAS_UID']; + $fields = $caseInstance->loadCase($_SESSION['APPLICATION'], $_SESSION['INDEX'], $flagJump); + $_SESSION['CURRENT_TASK'] = $fields['TAS_UID']; - require_once (PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php'); + require_once(PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php'); } } catch (Exception $e) { - $aMessage = array (); - $aMessage['MESSAGE'] = $e->getMessage(); + $message = []; + $message['MESSAGE'] = $e->getMessage(); $G_PUBLISH = new Publisher(); - $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); - G::RenderPage( 'publishBlank', 'blank' ); + $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $message); + G::RenderPage('publishBlank', 'blank'); } diff --git a/workflow/engine/methods/cases/cases_SaveData.php b/workflow/engine/methods/cases/cases_SaveData.php index d37f30f47..a218bd604 100644 --- a/workflow/engine/methods/cases/cases_SaveData.php +++ b/workflow/engine/methods/cases/cases_SaveData.php @@ -1,26 +1,7 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - */ + +use ProcessMaker\Validation\ValidationUploadedFiles; + //validate the data post if (!isset($_SESSION['USER_LOGGED'])) { if(!strpos($_SERVER['REQUEST_URI'], 'gmail')) { @@ -69,32 +50,12 @@ if (!isset($_SESSION['USER_LOGGED'])) { } } -/** - * If you can, you may want to set post_max_size to a low value (say 1M) to make - * testing easier. First test to see how your script behaves. Try uploading a file - * that is larger than post_max_size. If you do you will get a message like this - * in your error log: - * - * [09-Jun-2010 19:28:01] PHP Warning: POST Content-Length of 30980857 bytes exceeds - * the limit of 2097152 bytes in Unknown on line 0 - * - * This makes the script is not completed. - * - * Solving the problem: - * The PHP documentation http://php.net/manual/en/ini.core.php#ini.post-max-size - * provides a hack to solve this problem: - * - * If the size of post data is greater than post_max_size, the $_POST and $_FILES - * superglobals are empty. - */ -if ($_SERVER['REQUEST_METHOD'] == 'POST' && empty($_POST) && empty($_FILES) && $_SERVER['CONTENT_LENGTH'] > 0) { - $aMessage = array(); - $aMessage['MESSAGE'] = G::loadTranslation('ID_UPLOAD_ERR_INI_SIZE'); - $G_PUBLISH = new Publisher(); - $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage); - G::RenderPage('publish', 'blank'); +ValidationUploadedFiles::getValidationUploadedFiles()->dispatch(function($validator) { + G::SendMessageText($validator->getMessage(), "ERROR"); + $url = explode("sys" . config("system.workspace"), $_SERVER['HTTP_REFERER']); + G::header("location: " . "/sys" . config("system.workspace") . $url[1]); die(); -} +}); try { if ($_GET['APP_UID'] !== $_SESSION['APPLICATION']) { diff --git a/workflow/engine/methods/cases/open.php b/workflow/engine/methods/cases/open.php index 0b2b9685a..c30ea1c4b 100644 --- a/workflow/engine/methods/cases/open.php +++ b/workflow/engine/methods/cases/open.php @@ -1,4 +1,21 @@ getApplicationUIDByNumber(htmlspecialchars($_GET['APP_NUMBER'])); + $caseInstance = new Cases(); + $appUid = $caseInstance->getApplicationUIDByNumber(htmlspecialchars($_GET['APP_NUMBER'])); if (is_null($appUid)) { throw new Exception(G::LoadTranslation('ID_CASE_DOES_NOT_EXISTS')); } } else { $appUid = htmlspecialchars($_GET['APP_UID']); } -//If we don't have the DEL_INDEX we get the current delIndex. Data reporting tool does not have this information +//If we don't have the DEL_INDEX we get the current delIndex for example data reporting tool and jump to if (!isset($_GET['DEL_INDEX'])) { - $oCase = new Cases(); - $delIndex = $oCase->getCurrentDelegation($appUid, $_SESSION['USER_LOGGED']); + $caseInstance = new Cases(); + $delIndex = $caseInstance->getCurrentDelegation($appUid, $_SESSION['USER_LOGGED']); if (is_null($delIndex)) { throw new Exception(G::LoadTranslation('ID_CASE_IS_CURRENTLY_WITH_ANOTHER_USER')); } @@ -34,13 +51,11 @@ if (!isset($_GET['DEL_INDEX'])) { $tasUid = (isset($_GET['TAS_UID'])) ? $tasUid = htmlspecialchars($_GET['TAS_UID']) : ''; -$oCase = new Cases(); +$caseInstance = new Cases(); $conf = new Configurations(); - -$oHeadPublisher = headPublisher::getSingleton(); +$headPublisher = headPublisher::getSingleton(); $urlToRedirectAfterPause = 'casesListExtJs'; - /*----------------------------------********---------------------------------*/ $licensedFeatures = PMLicensedFeatures::getSingleton(); if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) { @@ -52,78 +67,110 @@ if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) { } /*----------------------------------********---------------------------------*/ - -$oHeadPublisher->assign('urlToRedirectAfterPause', $urlToRedirectAfterPause); - - -$oHeadPublisher->addExtJsScript('app/main', true); -$oHeadPublisher->addExtJsScript('cases/open', true); -$oHeadPublisher->assign('FORMATS', $conf->getFormats()); +$headPublisher->assign('urlToRedirectAfterPause', $urlToRedirectAfterPause); +$headPublisher->addExtJsScript('app/main', true); +$headPublisher->addExtJsScript('cases/open', true); +$headPublisher->assign('FORMATS', $conf->getFormats()); $uri = ''; foreach ($_GET as $k => $v) { $uri .= ($uri == '') ? "$k=$v" : "&$k=$v"; } -if (isset($_GET['action']) && ($_GET['action'] == 'jump')) { - $oNewCase = new \ProcessMaker\BusinessModel\Cases(); - //We need to get the last index OPEN or CLOSED (by Paused cases) - //Set true because we need to check if the case is paused - $delIndex = $oNewCase->getOneLastThread($appUid, true); - $case = $oCase->loadCase($appUid, $delIndex, $_GET['action']); -} else { - $case = $oCase->loadCase($appUid, $delIndex); +/** + * @todo, the action over the case from Open Case, Case Link and jump to needs to work similar, we need to have a PRD + */ + +$case = $caseInstance->loadCase($appUid, $delIndex); +$canClaimCase = false; +$caseCanBeReview = false; +if (isset($_GET['action'])) { + switch ($_GET['action']) { + case 'todo': //Inbox + case 'draft': //Draft + case 'sent': //Participated + case 'unassigned': //Unassigned + case 'paused': //Paused + case 'search': //Advanced search + //For add the validation in the others list we need to a have a PRD, because is change of the functionality + break; + case 'to_reassign': //Reassign + //From reassign: Review if the user can be claim the case + if ($caseInstance->isSelfService($_SESSION['USER_LOGGED'], $case['TAS_UID'], $appUid)) { + $canClaimCase = true; + } + break; + case 'to_revise': //Review + $proSupervisor = new ProcessSupervisor(); + $caseCanBeReview = $proSupervisor->reviewCaseStatusForSupervisor($appUid, $delIndex); + break; + case 'jump': //Jump To action + //From Review: Review if the user is supervisor + if (isset($_GET['actionFromList']) && ($_GET['actionFromList'] === 'to_revise')) { + $proSupervisor = new ProcessSupervisor(); + $caseCanBeReview = $proSupervisor->reviewCaseStatusForSupervisor($appUid, $delIndex); + } + //From Unassigned: Review if the user can be claim the case + if ($caseInstance->isSelfService($_SESSION['USER_LOGGED'], $case['TAS_UID'], $appUid)) { + $canClaimCase = true; + } + //From Paused: Get the last index OPEN or CLOSED (by Paused cases) + $bmCases = new BmCases(); + $delIndex = $bmCases->getOneLastThread($appUid, true); + $case = $caseInstance->loadCase($appUid, $delIndex, $_GET['action']); + break; + } } -if (isset($_GET['actionFromList']) && ($_GET['actionFromList'] === 'to_revise')) { - $oSupervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor(); - $caseCanBeReview = $oSupervisor->reviewCaseStatusForSupervisor($appUid, $delIndex); - //Check if the case has the correct status for update the information from supervisor/review - if (!$caseCanBeReview) { - //The supervisor can not edit the information - $script = 'cases_Open?'; - } else { - //The supervisor can edit the information, the case are in TO_DO - $script = 'cases_OpenToRevise?APP_UID=' . $appUid . '&DEL_INDEX=' . $delIndex . '&TAS_UID=' . $tasUid; - $oHeadPublisher->assign('treeToReviseTitle', G::loadtranslation('ID_STEP_LIST')); - $casesPanelUrl = 'casesToReviseTreeContent?APP_UID=' . $appUid . '&DEL_INDEX=' . $delIndex; - $oHeadPublisher->assign('casesPanelUrl', $casesPanelUrl); //translations - echo "
"; - } -} else { +/** + * Review if the user can be open the case from Review list + * @link https://wiki.processmaker.com/3.2/Cases/Process_Supervisor#Review + */ +if (!$caseCanBeReview) { + //The supervisor can not edit the information $script = 'cases_Open?'; +} else { + //The supervisor can edit the information, the case are in TO_DO + $script = 'cases_OpenToRevise?APP_UID=' . $appUid . '&DEL_INDEX=' . $delIndex . '&TAS_UID=' . $tasUid; + $headPublisher->assign('treeToReviseTitle', G::loadtranslation('ID_STEP_LIST')); + $casesPanelUrl = 'casesToReviseTreeContent?APP_UID=' . $appUid . '&DEL_INDEX=' . $delIndex; + $headPublisher->assign('casesPanelUrl', $casesPanelUrl); //translations + echo "
"; } $process = new Process(); $fields = $process->load($case['PRO_UID']); $isBpmn = $fields['PRO_BPMN'] === 1 ? true : false; +/** + * Review if the user can be open summary form + * @link https://wiki.processmaker.com/3.2/Case_Summary#Viewing_the_Custom_Dynaform_when_Opening_a_Case + */ $showCustomForm = false; /*----------------------------------********---------------------------------*/ - -$respView = $oCase->getAllObjectsFrom($case['PRO_UID'], $appUid, $case['TAS_UID'], $_SESSION['USER_LOGGED'], 'VIEW'); +$respView = $caseInstance->getAllObjectsFrom($case['PRO_UID'], $appUid, $case['TAS_UID'], $_SESSION['USER_LOGGED'], 'VIEW'); $viewSummaryForm = isset($respView['SUMMARY_FORM']) && $respView['SUMMARY_FORM'] === 1 ? true : false; $isNoEmpty = isset($fields['PRO_DYNAFORMS']['PROCESS']) && !empty($fields['PRO_DYNAFORMS']['PROCESS']); if ($isBpmn && $viewSummaryForm && $isNoEmpty) { $showCustomForm = true; } - /*----------------------------------********---------------------------------*/ -$oStep = new Step(); -$oStep = $oStep->loadByProcessTaskPosition($case['PRO_UID'], $case['TAS_UID'], 1); -$oHeadPublisher->assign('uri', $script . $uri); -$oHeadPublisher->assign('_APP_NUM', '#: ' . $case['APP_NUMBER']); -$oHeadPublisher->assign('_PROJECT_TYPE', $isBpmn ? 'bpmn' : 'classic'); -$oHeadPublisher->assign('_PRO_UID', $case['PRO_UID']); -$oHeadPublisher->assign('_APP_UID', $appUid); -$oHeadPublisher->assign('_ENV_CURRENT_DATE', $conf->getSystemDate(date('Y-m-d'))); -$oHeadPublisher->assign('_ENV_CURRENT_DATE_NO_FORMAT', date('Y-m-d-h-i-A')); -$oHeadPublisher->assign('idfirstform', is_null($oStep) ? '-1' : $oStep->getStepUidObj()); -$oHeadPublisher->assign('appStatus', $case['APP_STATUS']); -$oHeadPublisher->assign('tbarGmail', $tBarGmail); -$oHeadPublisher->assign('showCustomForm', $showCustomForm); +$step = new Step(); +$step = $step->loadByProcessTaskPosition($case['PRO_UID'], $case['TAS_UID'], 1); +$headPublisher->assign('uri', $script . $uri); +$headPublisher->assign('_APP_NUM', '#: ' . $case['APP_NUMBER']); +$headPublisher->assign('_PROJECT_TYPE', $isBpmn ? 'bpmn' : 'classic'); +$headPublisher->assign('_PRO_UID', $case['PRO_UID']); +$headPublisher->assign('_APP_UID', $appUid); +$headPublisher->assign('_ENV_CURRENT_DATE', $conf->getSystemDate(date('Y-m-d'))); +$headPublisher->assign('_ENV_CURRENT_DATE_NO_FORMAT', date('Y-m-d-h-i-A')); +$headPublisher->assign('idfirstform', is_null($step) ? '-1' : $step->getStepUidObj()); +$headPublisher->assign('appStatus', $case['APP_STATUS']); +$headPublisher->assign('tbarGmail', $tBarGmail); +$headPublisher->assign('showCustomForm', $showCustomForm); +$headPublisher->assign('canClaimCase', $canClaimCase); if (!isset($_SESSION['APPLICATION']) || !isset($_SESSION['TASK']) || !isset($_SESSION['INDEX'])) { $_SESSION['PROCESS'] = $case['PRO_UID']; diff --git a/workflow/engine/methods/services/ActionsByEmailDataFormPost.php b/workflow/engine/methods/services/ActionsByEmailDataFormPost.php index d06640ba5..ed7ee157b 100644 --- a/workflow/engine/methods/services/ActionsByEmailDataFormPost.php +++ b/workflow/engine/methods/services/ActionsByEmailDataFormPost.php @@ -1,5 +1,10 @@ 0) { + //It is very important to obtain APP_DATA values because they may have changed in the derivation. + $case = new Cases(); + $appFields = $case->loadCase($appUid); + $casesFields["APP_DATA"] = array_merge($casesFields["APP_DATA"], $appFields["APP_DATA"]); + $oInputDocument = new \ProcessMaker\BusinessModel\Cases\InputDocument(); $oInputDocument->uploadFileCase($_FILES, $case, $casesFields, $currentUsrUid, $appUid, $delIndex); } diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php b/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php index 799e086ae..4532b0f69 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php @@ -2128,6 +2128,11 @@ class Cases * * @param string $applicationUid Unique id of Case * + * @see workflow/engine/src/ProcessMaker/Services/Api/Cases.php + * @see workflow/engine/src/ProcessMaker/Services/Api/Light.php + * + * @link https://wiki.processmaker.com/3.3/REST_API_Cases/Cases#Get_Case.27s_Tasks:_GET_.2Fcases.2F.7Bapp_uid.7D.2Ftasks + * * @return array Return an array with all Tasks of Case * @throws Exception */ @@ -2151,33 +2156,20 @@ class Cases $taskUid = ""; - //Get data - //SQL - $delimiter = DBAdapter::getStringDelimiter(); + //Obtain the list of tasks and their respectives users assigned to each one for an specific case + $case = new ClassesCases(); + $rsTasks = $case->getTasksInfoForACase($applicationUid, $processUid); - $criteria = new Criteria("workflow"); + while ($rsTasks->next()) { + $row = $rsTasks->getRow(); - $criteria->addSelectColumn(TaskPeer::TAS_UID); - $criteria->addSelectColumn(TaskPeer::TAS_TITLE); - $criteria->addSelectColumn(TaskPeer::TAS_DESCRIPTION); - $criteria->addSelectColumn(TaskPeer::TAS_START); - $criteria->addSelectColumn(TaskPeer::TAS_TYPE); - $criteria->addSelectColumn(TaskPeer::TAS_DERIVATION); - $criteria->addSelectColumn(TaskPeer::TAS_ASSIGN_TYPE); - $criteria->addSelectColumn(UsersPeer::USR_UID); - $criteria->addSelectColumn(UsersPeer::USR_USERNAME); - $criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME); - $criteria->addSelectColumn(UsersPeer::USR_LASTNAME); - - $criteria->addJoin(TaskPeer::TAS_LAST_ASSIGNED, UsersPeer::USR_UID, Criteria::LEFT_JOIN); - - $criteria->add(TaskPeer::PRO_UID, $processUid, Criteria::EQUAL); - - $rsCriteria = TaskPeer::doSelectRS($criteria); - $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); - - while ($rsCriteria->next()) { - $row = $rsCriteria->getRow(); + //If the task is a multiple task + if ($row["TAS_ASSIGN_TYPE"] == 'MULTIPLE_INSTANCE' || $row["TAS_ASSIGN_TYPE"] == 'MULTIPLE_INSTANCE_VALUE_BASED') { + $row["USR_UID"] = ""; + $row["USR_USERNAME"] = ""; + $row["USR_FIRSTNAME"] = ""; + $row["USR_LASTNAME"] = ""; + } //Task if ($row["TAS_TYPE"] == "NORMAL") { @@ -2189,17 +2181,9 @@ class Cases $row["TAS_TITLE"] = $task->getTasTitle(); } } else { - $criteria2 = new Criteria("workflow"); - $criteria2->addSelectColumn(SubProcessPeer::PRO_UID); - $criteria2->addSelectColumn(TaskPeer::TAS_TITLE); - $criteria2->addSelectColumn(TaskPeer::TAS_DESCRIPTION); - $criteria2->addJoin(SubProcessPeer::TAS_PARENT, TaskPeer::TAS_UID, Criteria::LEFT_JOIN); - $criteria2->add(SubProcessPeer::PRO_PARENT, $processUid); - $criteria2->add(SubProcessPeer::TAS_PARENT, $row["TAS_UID"]); - - $rsCriteria2 = SubProcessPeer::doSelectRS($criteria2); - $rsCriteria2->setFetchmode(ResultSet::FETCHMODE_ASSOC); + //Get the task information when the task type is different from normal + $rsCriteria2 = $case->getTaskInfoForSubProcess($processUid, $row["TAS_UID"]); $rsCriteria2->next(); @@ -2215,18 +2199,8 @@ class Cases $routeType = ""; $arrayRoute = array(); - $criteria2 = new Criteria("workflow"); - - $criteria2->addAsColumn("ROU_NUMBER", RoutePeer::ROU_CASE); - $criteria2->addSelectColumn(RoutePeer::ROU_TYPE); - $criteria2->addSelectColumn(RoutePeer::ROU_CONDITION); - $criteria2->addAsColumn("TAS_UID", RoutePeer::ROU_NEXT_TASK); - $criteria2->add(RoutePeer::PRO_UID, $processUid, Criteria::EQUAL); - $criteria2->add(RoutePeer::TAS_UID, $row["TAS_UID"], Criteria::EQUAL); - $criteria2->addAscendingOrderByColumn("ROU_NUMBER"); - - $rsCriteria2 = RoutePeer::doSelectRS($criteria2); - $rsCriteria2->setFetchmode(ResultSet::FETCHMODE_ASSOC); + //Get the routes of a task + $rsCriteria2 = $case->getTaskRoutes($processUid, $row["TAS_UID"]); while ($rsCriteria2->next()) { $row2 = $rsCriteria2->getRow(); @@ -2243,25 +2217,7 @@ class Cases //Delegations $arrayAppDelegation = array(); - $criteria2 = new Criteria("workflow"); - - $criteria2->addSelectColumn(AppDelegationPeer::DEL_INDEX); - $criteria2->addSelectColumn(AppDelegationPeer::DEL_INIT_DATE); - $criteria2->addSelectColumn(AppDelegationPeer::DEL_TASK_DUE_DATE); - $criteria2->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE); - $criteria2->addSelectColumn(UsersPeer::USR_UID); - $criteria2->addSelectColumn(UsersPeer::USR_USERNAME); - $criteria2->addSelectColumn(UsersPeer::USR_FIRSTNAME); - $criteria2->addSelectColumn(UsersPeer::USR_LASTNAME); - - $criteria2->addJoin(AppDelegationPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN); - - $criteria2->add(AppDelegationPeer::APP_UID, $applicationUid, Criteria::EQUAL); - $criteria2->add(AppDelegationPeer::TAS_UID, $row["TAS_UID"], Criteria::EQUAL); - $criteria2->addAscendingOrderByColumn(AppDelegationPeer::DEL_INDEX); - - $rsCriteria2 = AppDelegationPeer::doSelectRS($criteria2); - $rsCriteria2->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rsCriteria2 = $case->getCaseDelegations($applicationUid, $row["TAS_UID"]); while ($rsCriteria2->next()) { $row2 = $rsCriteria2->getRow(); @@ -2292,8 +2248,10 @@ class Cases $appDelegationDuration = G::LoadTranslation("ID_NOT_FINISHED"); - if (!empty($row2["DEL_FINISH_DATE"]) && !empty($row2["DEL_INIT_DATE"])) { - $t = strtotime($row2["DEL_FINISH_DATE"]) - strtotime($row2["DEL_INIT_DATE"]); + $date = empty($row2["DEL_INIT_DATE"]) ? $row2["DEL_DELEGATE_DATE"] : $row2["DEL_INIT_DATE"]; + + if (!empty($row2["DEL_FINISH_DATE"]) && !empty($date)) { + $t = strtotime($row2["DEL_FINISH_DATE"]) - strtotime($date); $h = $t * (1 / 60) * (1 / 60); $m = ($h - (int)($h)) * (60 / 1); @@ -2314,40 +2272,22 @@ class Cases $this->getFieldNameByFormatFieldName("DEL_FINISH_DATE") => $arrayAppDelegationDate["DEL_FINISH_DATE"]["dateFormated"], $this->getFieldNameByFormatFieldName("DEL_DURATION") => $appDelegationDuration, $this->getFieldNameByFormatFieldName("USR_UID") => $row2["USR_UID"], - $this->getFieldNameByFormatFieldName("USR_USERNAME") => $row2["USR_USERNAME"] . "", - $this->getFieldNameByFormatFieldName("USR_FIRSTNAME") => $row2["USR_FIRSTNAME"] . "", - $this->getFieldNameByFormatFieldName("USR_LASTNAME") => $row2["USR_LASTNAME"] . "" + $this->getFieldNameByFormatFieldName("USR_USERNAME") => $row2["USR_USERNAME"], + $this->getFieldNameByFormatFieldName("USR_FIRSTNAME") => $row2["USR_FIRSTNAME"], + $this->getFieldNameByFormatFieldName("USR_LASTNAME") => $row2["USR_LASTNAME"] ); } //Status $status = ""; - //$criteria2 - $criteria2 = new Criteria("workflow"); - - $criteria2->addAsColumn("CANT", "COUNT(" . AppDelegationPeer::APP_UID . ")"); - $criteria2->addAsColumn("FINISH", "MIN(" . AppDelegationPeer::DEL_FINISH_DATE . ")"); - $criteria2->add(AppDelegationPeer::APP_UID, $applicationUid, Criteria::EQUAL); - $criteria2->add(AppDelegationPeer::TAS_UID, $row["TAS_UID"], Criteria::EQUAL); - - $rsCriteria2 = AppDelegationPeer::doSelectRS($criteria2); - $rsCriteria2->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rsCriteria2 = $case->getTotalAndMinDateForACase($applicationUid, $row["TAS_UID"]); $rsCriteria2->next(); $row2 = $rsCriteria2->getRow(); - //$criteria3 - $criteria3 = new Criteria("workflow"); - - $criteria3->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE); - $criteria3->add(AppDelegationPeer::APP_UID, $applicationUid, Criteria::EQUAL); - $criteria3->add(AppDelegationPeer::TAS_UID, $row["TAS_UID"], Criteria::EQUAL); - $criteria3->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL); - - $rsCriteria3 = AppDelegationPeer::doSelectRS($criteria3); - $rsCriteria3->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rsCriteria3 = $case->getDelegationFinishDate($applicationUid, $row["TAS_UID"]); $rsCriteria3->next(); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/InputDocument.php b/workflow/engine/src/ProcessMaker/BusinessModel/InputDocument.php index 62122e104..3fc84d723 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/InputDocument.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/InputDocument.php @@ -1,7 +1,10 @@ doPostInputDocument() + * @link https://wiki.processmaker.com/3.0/Input_Documents#Creating_Input_Documents */ public function create($processUid, $arrayData) { @@ -310,6 +316,8 @@ class InputDocument $flagDataDestinationPath = (isset($arrayData["INP_DOC_DESTINATION_PATH"]))? 1 : 0; $flagDataTags = (isset($arrayData["INP_DOC_TAGS"]))? 1 : 0; + $this->throwExceptionIfMaximumFileSizeExceed(intval($arrayData["INP_DOC_MAX_FILESIZE"]), $arrayData["INP_DOC_MAX_FILESIZE_UNIT"]); + //Create $inputDocument = new \InputDocument(); @@ -348,8 +356,11 @@ class InputDocument * * @param string $inputDocumentUid Unique id of InputDocument * @param array $arrayData Data - * - * return array Return data of the InputDocument updated + * + * @return array Return data of the InputDocument updated + * + * @see \ProcessMaker\Services\Api\Project\InputDocument->doPutInputDocument() + * @link https://wiki.processmaker.com/3.0/Input_Documents#Creating_Input_Documents */ public function update($inputDocumentUid, $arrayData) { @@ -374,6 +385,8 @@ class InputDocument if (isset($arrayData["INP_DOC_TITLE"])) { $this->throwExceptionIfExistsTitle($processUid, $arrayData["INP_DOC_TITLE"], $this->arrayFieldNameForException["inputDocumentTitle"], $inputDocumentUid); } + + $this->throwExceptionIfMaximumFileSizeExceed(intval($arrayData["INP_DOC_MAX_FILESIZE"]), $arrayData["INP_DOC_MAX_FILESIZE_UNIT"]); //Update $arrayData["INP_DOC_UID"] = $inputDocumentUid; @@ -519,7 +532,7 @@ class InputDocument * * @param string $inputDocumentUid Unique id of InputDocument * - * return array Return an array with data of an InputDocument + * @return array Return an array with data of an InputDocument */ public function getInputDocument($inputDocumentUid) { @@ -544,5 +557,71 @@ class InputDocument throw $e; } } + + /** + * Throw exception if maximum file size exceed to php directives. + * + * @param int $value + * @param string $unit + * @throws Exception + * + * @see ProcessMaker\BusinessModel\InputDocument->create() + * @see ProcessMaker\BusinessModel\InputDocument->update() + * @link https://wiki.processmaker.com/3.2/Input_Documents + */ + public function throwExceptionIfMaximumFileSizeExceed($value, $unit) + { + //The value of 'INP_DOC_MAX_FILESIZE_UNIT' can only take two values: 'KB'and 'MB'. + if ($unit === "MB") { + $value = $value * (1024 ** 2); + } + if ($unit === "KB") { + $value = $value * (1024 ** 1); + } + $object = $this->getMaxFileSize(); + if ($object->uploadMaxFileSizeBytes < $value) { + throw new Exception(G::LoadTranslation("ID_THE_MAXIMUM_VALUE_OF_THIS_FIELD_IS", [$object->uploadMaxFileSize])); + } + } + + /** + * To upload large files, post_max_size value must be larger than upload_max_filesize. + * Generally speaking, memory_limit should be larger than post_max_size. When an integer + * is used, the value is measured in bytes. The shorthand notation may also be used. + * If the size of post data is greater than post_max_size, the $_POST and $_FILES + * superglobals are empty. + * + * @return object + * + * @see ProcessMaker\BusinessModel\InputDocument->throwExceptionIfMaximumFileSizeExceed() + * @link https://wiki.processmaker.com/3.2/Input_Documents + * @link http://php.net/manual/en/faq.using.php#faq.using.shorthandbytes + */ + public function getMaxFileSize() + { + $phpShorthandByte = new PhpShorthandByte(); + $postMaxSize = ini_get("post_max_size"); + $postMaxSizeBytes = $phpShorthandByte->valueToBytes($postMaxSize); + $uploadMaxFileSize = ini_get("upload_max_filesize"); + $uploadMaxFileSizeBytes = $phpShorthandByte->valueToBytes($uploadMaxFileSize); + + if ($postMaxSizeBytes < $uploadMaxFileSizeBytes) { + $uploadMaxFileSize = $postMaxSize; + $uploadMaxFileSizeBytes = $postMaxSizeBytes; + } + + //according to the acceptance criteria the information is always shown in MBytes + $uploadMaxFileSizeMBytes = $uploadMaxFileSizeBytes / (1024 ** 2); //conversion constant + $uploadMaxFileSizeUnit = "MB"; //short processmaker notation, https://wiki.processmaker.com/3.0/File_control#Size_Unity + $uploadMaxFileSizePhpUnit = "M"; //short php notation, http://php.net/manual/en/faq.using.php#faq.using.shorthandbytes + + $result = [ + "uploadMaxFileSize" => $phpShorthandByte->getFormatBytes($uploadMaxFileSizeMBytes . $uploadMaxFileSizePhpUnit), + "uploadMaxFileSizeBytes" => $uploadMaxFileSizeBytes, + "uploadMaxFileSizeMBytes" => $uploadMaxFileSizeMBytes, + "uploadMaxFileSizeUnit" => $uploadMaxFileSizeUnit + ]; + return (object) $result; + } } diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Light.php b/workflow/engine/src/ProcessMaker/BusinessModel/Light.php index 16ba133e6..4cbdb2c48 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Light.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Light.php @@ -1490,6 +1490,7 @@ class Light } $response['listLanguage'] = $languagesList; if (isset($params['fileLimit']) && $params['fileLimit']) { + //to do: ProcessMaker\BusinessModel\InputDocument->getMaxFileSize() $postMaxSize = $this->return_bytes(ini_get('post_max_size')); $uploadMaxFileSize = $this->return_bytes(ini_get('upload_max_filesize')); if ($postMaxSize < $uploadMaxFileSize) { diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/ProcessMap.php b/workflow/engine/src/ProcessMaker/BusinessModel/ProcessMap.php index 068e795ef..ae0f84d5d 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/ProcessMap.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/ProcessMap.php @@ -117,7 +117,7 @@ class ProcessMap $tmpData[5] = ""; $tmpData[6] = $lanes['lan_name']; $tmpData[7] = ""; - $tmpData[8] = $lanes['lan_uid']; + $tmpData[8] = array_key_exists('lan_uid', $lanes) ? $lanes['lan_uid']: ""; $tmpData[9] = ""; $tmpData[10] = $lanes['bou_container']; @@ -719,7 +719,7 @@ class ProcessMap if($element['bou_container'] != "bpmnDiagram"){ $resRec = $this->getNewPoints($element['bou_element'],$element['bou_container']); } - if($element['lns_uid'] == $idElement || $element['lan_uid'] == $idElement){ + if ($element['lns_uid'] == $idElement || (array_key_exists('lan_uid', $element) ? $element['lan_uid'] == $idElement : false)) { $result = array($element['bou_x'] + $resRec[0],$element['bou_y'] + $resRec[1]); } } diff --git a/workflow/engine/src/ProcessMaker/Util/PhpShorthandByte.php b/workflow/engine/src/ProcessMaker/Util/PhpShorthandByte.php new file mode 100644 index 000000000..6207298be --- /dev/null +++ b/workflow/engine/src/ProcessMaker/Util/PhpShorthandByte.php @@ -0,0 +1,82 @@ +units = ['K', 'M', 'G']; + $this->terminal = "bytes"; + } + + /** + * Convert value string to bytes, for directives php.ini + * + * @param string $value + * @return integer + * + * @see ProcessMaker\BusinessModel\InputDocument->getMaxFileSize() + * @link http://php.net/manual/en/faq.using.php#faq.using.shorthandbytes + */ + public function valueToBytes($value) + { + foreach ($this->units as $i => $unit) { + $number = $this->getNumberValue($value, $unit); + if ($number !== null) { + $result = $number * (1024 ** ($i + 1)); + return $result; + } + } + return intval($value); + } + + /** + * Get number value and validate expresion. + * Valid expresion is: [number][unit] + * + * @param string $string + * @param string $unit + * @return integer|null + * + * @see ProcessMaker\Util\PhpShorthandByte->valueToBytes() + * @link http://php.net/manual/en/faq.using.php#faq.using.shorthandbytes + */ + public function getNumberValue($string, $unit) + { + $string = preg_replace('/\s+/', '', $string); + $isCorrect = preg_match("/\d+{$unit}/", $string); + if ($isCorrect === 1) { + $result = rtrim($string, $unit); + return intval($result); + } + return null; + } + + /** + * Get format bytes. + * + * @param string $value + * @return string + */ + public function getFormatBytes($value) + { + foreach ($this->units as $i => $unit) { + $number = $this->getNumberValue($value, $unit); + if ($number !== null) { + return $number . " " . $unit . $this->terminal; + } + } + return $value; + } +} diff --git a/workflow/engine/src/ProcessMaker/Validation/ValidationUploadedFiles.php b/workflow/engine/src/ProcessMaker/Validation/ValidationUploadedFiles.php index ccd5cc6f1..d354f21fa 100644 --- a/workflow/engine/src/ProcessMaker/Validation/ValidationUploadedFiles.php +++ b/workflow/engine/src/ProcessMaker/Validation/ValidationUploadedFiles.php @@ -8,6 +8,7 @@ use Illuminate\Filesystem\Filesystem; use Illuminate\Support\Facades\Cache; use ProcessMaker\Core\System; use ProcessMaker\Services\OAuth2\Server; +use ProcessMaker\Util\PhpShorthandByte; use Symfony\Component\HttpFoundation\File\File; class ValidationUploadedFiles @@ -169,6 +170,8 @@ class ValidationUploadedFiles * File upload validation. * * @return $this + * + * @see workflow/public_html/sysGeneric.php */ public function runRulesToAllUploadedFiles() { @@ -177,6 +180,12 @@ class ValidationUploadedFiles return; } $this->fails = []; + + $validator = $this->runRulesForFileEmpty(); + if ($validator->fails()) { + $this->fails[] = $validator; + } + foreach ($files as $file) { $data = (object) $file; if (!is_array($data->name) || !is_array($data->tmp_name)) { @@ -207,9 +216,70 @@ class ValidationUploadedFiles } } } + return $this; } + /** + * Run rules if files is empty. + * + * @see ProcessMaker\Validation\ValidationUploadedFiles->runRulesToAllUploadedFiles() + * @see Luracast\Restler\Format\UploadFormat->decode() + */ + public function runRulesForFileEmpty() + { + $validator = new Validator(); + + //rule: validate $_SERVER['CONTENT_LENGTH'] + $rule = $validator->addRule(); + $rule->validate(null, function($file) use ($rule) { + //according to the acceptance criteria the information is always shown in MBytes + $phpShorthandByte = new PhpShorthandByte(); + $postMaxSize = ini_get("post_max_size"); + $postMaxSizeBytes = $phpShorthandByte->valueToBytes($postMaxSize); + $uploadMaxFileSize = ini_get("upload_max_filesize"); + $uploadMaxFileSizeBytes = $phpShorthandByte->valueToBytes($uploadMaxFileSize); + + if ($postMaxSizeBytes < $uploadMaxFileSizeBytes) { + $uploadMaxFileSize = $postMaxSize; + $uploadMaxFileSizeBytes = $postMaxSizeBytes; + } + //according to the acceptance criteria the information is always shown in MBytes + $uploadMaxFileSizeMBytes = $uploadMaxFileSizeBytes / (1024 ** 2); //conversion constant + + $message = G::LoadTranslation('ID_THE_FILE_SIZE_IS_BIGGER_THAN_THE_MAXIMUM_ALLOWED', [$uploadMaxFileSizeMBytes]); + $rule->message($message); + /** + * If you can, you may want to set post_max_size to a low value (say 1M) to make + * testing easier. First test to see how your script behaves. Try uploading a file + * that is larger than post_max_size. If you do you will get a message like this + * in your error log: + * + * [09-Jun-2010 19:28:01] PHP Warning: POST Content-Length of 30980857 bytes exceeds + * the limit of 2097152 bytes in Unknown on line 0 + * + * This makes the script is not completed. + * + * Solving the problem: + * The PHP documentation http://php.net/manual/en/ini.core.php#ini.post-max-size + * provides a hack to solve this problem: + * + * If the size of post data is greater than post_max_size, the $_POST and $_FILES + * superglobals are empty. + */ + if ($_SERVER['REQUEST_METHOD'] === 'POST' && empty($_POST) && empty($_FILES) && $_SERVER['CONTENT_LENGTH'] > 0) { + return true; + } + return false; + }) + ->status(400) + ->log(function($rule) { + Bootstrap::registerMonologPhpUploadExecution('phpUpload', 400, $rule->getMessage(), ""); + }); + + return $validator->validate(); + } + /** * Get the first error and call the argument function. * diff --git a/workflow/engine/templates/cases/open.js b/workflow/engine/templates/cases/open.js index 4bb148437..02bf72736 100644 --- a/workflow/engine/templates/cases/open.js +++ b/workflow/engine/templates/cases/open.js @@ -562,7 +562,8 @@ Ext.onReady(function(){ return key === false ? result : null; } - if (this.showCustomForm && this.showCustomForm === true && getParameterURL('action') === 'unassigned') { + var urlAction = getParameterURL('action'); + if (this.showCustomForm && this.showCustomForm === true && (urlAction === 'unassigned' || this.canClaimCase === true)) { navPanel.items[navPanel.items.length] = navPanelBottom; } diff --git a/workflow/engine/templates/designer/index.html b/workflow/engine/templates/designer/index.html index a40df5785..da5100749 100644 --- a/workflow/engine/templates/designer/index.html +++ b/workflow/engine/templates/designer/index.html @@ -29,6 +29,7 @@ var SYS_LANG = "{$SYS_LANG}"; var SYS_SKIN = "{$SYS_SKIN}"; var HTTP_SERVER_HOSTNAME = "{$HTTP_SERVER_HOSTNAME}"; + var maxFileSizeInformation = {$maxFileSizeInformation}; @@ -86,6 +87,7 @@ var SYS_LANG = "{$SYS_LANG}"; var SYS_SKIN = "{$SYS_SKIN}"; var HTTP_SERVER_HOSTNAME = "{$HTTP_SERVER_HOSTNAME}"; + var maxFileSizeInformation = {$maxFileSizeInformation}; {foreach from=$sourceJs item=pathFile} diff --git a/workflow/public_html/sysGeneric.php b/workflow/public_html/sysGeneric.php index f9e4f8c64..d4ee8e48a 100644 --- a/workflow/public_html/sysGeneric.php +++ b/workflow/public_html/sysGeneric.php @@ -301,10 +301,11 @@ if (!(array_key_exists('REMOTE_USER', $_SERVER) && (string)($_SERVER['REMOTE_USE ini_set('session.cookie_httponly', 1); ini_set('session.cookie_secure', 1); } -//$e_all = defined( 'E_DEPRECATED' ) ? E_ALL & ~ E_DEPRECATED : E_ALL; -//$e_all = defined( 'E_STRICT' ) ? $e_all & ~ E_STRICT : $e_all; -//$e_all = $config['debug'] ? $e_all : $e_all & ~ E_NOTICE; -//$e_all = E_ALL & ~ E_DEPRECATED & ~ E_STRICT & ~ E_NOTICE & ~E_WARNING; + +//Set Time Zone +/*----------------------------------********---------------------------------*/ +$_SESSION['__SYSTEM_UTC_TIME_ZONE__'] = (int)($config['system_utc_time_zone']) == 1; +/*----------------------------------********---------------------------------*/ // Do not change any of these settings directly, use env.ini instead ini_set('display_errors', $config['display_errors']); @@ -313,7 +314,8 @@ ini_set('short_open_tag', 'On'); ini_set('default_charset', "UTF-8"); ini_set('memory_limit', $config['memory_limit']); ini_set('soap.wsdl_cache_enabled', $config['wsdl_cache']); -ini_set('date.timezone', $config['time_zone']); //Set Time Zone +ini_set('date.timezone', + (isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__']) ? 'UTC' : $config['time_zone']); //Set Time Zone define('DEBUG_SQL_LOG', $config['debug_sql']); define('DEBUG_SQL', $config['debug']); @@ -321,9 +323,7 @@ define('DEBUG_TIME_LOG', $config['debug_time']); define('DEBUG_CALENDAR_LOG', $config['debug_calendar']); define('MEMCACHED_ENABLED', $config['memcached']); define('MEMCACHED_SERVER', $config['memcached_server']); - define('WS_IN_LOGIN', isset($config['WS_IN_LOGIN']) ? $config['WS_IN_LOGIN'] : 'serverconf'); - define('LOAD_HEADERS_IE', $config['load_headers_ie']); define('LEAVE_CASE_WARNING', $config['leave_case_warning']); define('REDIRECT_TO_MOBILE', $config['redirect_to_mobile']); @@ -332,6 +332,7 @@ define('DISABLE_DOWNLOAD_DOCUMENTS_SESSION_VALIDATION', $config['disable_downloa define('LOGS_MAX_FILES', $config['logs_max_files']); define('LOGS_LOCATION', $config['logs_location']); define('LOGGING_LEVEL', $config['logging_level']); +define('TIME_ZONE', ini_get('date.timezone')); // IIS Compatibility, SERVER_ADDR doesn't exist on that env, so we need to define it. $_SERVER['SERVER_ADDR'] = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : $_SERVER['SERVER_NAME']; @@ -565,7 +566,11 @@ ini_set('short_open_tag', 'On'); ini_set('default_charset', "UTF-8"); ini_set('memory_limit', $config['memory_limit']); ini_set('soap.wsdl_cache_enabled', $config['wsdl_cache']); -ini_set('date.timezone', $config['time_zone']); //Set Time Zone +ini_set('date.timezone', TIME_ZONE); //Set Time Zone + +date_default_timezone_set(TIME_ZONE); + +config(['app.timezone' => TIME_ZONE]); // Load Language Translation Bootstrap::LoadTranslationObject(defined('SYS_LANG') ? SYS_LANG : "en"); @@ -707,16 +712,6 @@ Bootstrap::LoadTranslationPlugins(defined('SYS_LANG') ? SYS_LANG : "en", $attrib // Initialization functions plugins $oPluginRegistry->init(); -//Set Time Zone -/*----------------------------------********---------------------------------*/ -$_SESSION['__SYSTEM_UTC_TIME_ZONE__'] = (int)($config['system_utc_time_zone']) == 1; -/*----------------------------------********---------------------------------*/ - -ini_set('date.timezone', - (isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__']) ? 'UTC' : $config['time_zone']); //Set Time Zone - -define('TIME_ZONE', ini_get('date.timezone')); - /*----------------------------------********---------------------------------*/ $_GET = \ProcessMaker\Util\DateTime::convertDataToUtc($_GET); $_POST = \ProcessMaker\Util\DateTime::convertDataToUtc($_POST);