This commit is contained in:
Paula Quispe
2019-05-07 14:25:07 -04:00
25 changed files with 864 additions and 438 deletions

View File

@@ -14,6 +14,7 @@ return [
'cache_lifetime' => env('APP_CACHE_LIFETIME', 60), 'cache_lifetime' => env('APP_CACHE_LIFETIME', 60),
'key' => env('APP_KEY', 'base64:rU28h/tElUn/eiLY0qC24jJq1rakvAFRoRl1DWxj/kM='), 'key' => env('APP_KEY', 'base64:rU28h/tElUn/eiLY0qC24jJq1rakvAFRoRl1DWxj/kM='),
'cipher' => 'AES-256-CBC', 'cipher' => 'AES-256-CBC',
'timezone' => 'UTC',
'providers' => [ 'providers' => [
CacheServiceProvider::class, CacheServiceProvider::class,
FilesystemServiceProvider::class, FilesystemServiceProvider::class,

View File

@@ -2,6 +2,7 @@
namespace Luracast\Restler\Format; namespace Luracast\Restler\Format;
use Luracast\Restler\RestException; use Luracast\Restler\RestException;
use ProcessMaker\Validation\ValidationUploadedFiles;
/** /**
* Extending UploadFormat Support for Multi Part Form Data and File Uploads * 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'); 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) public function decode($data)
{ {
$runRulesForFileEmpty = ValidationUploadedFiles::getValidationUploadedFiles()->runRulesForFileEmpty();
if ($runRulesForFileEmpty->fails()) {
throw new RestException($runRulesForFileEmpty->getStatus(), $runRulesForFileEmpty->getMessage());
}
$doMimeCheck = !empty(self::$allowedMimeTypes); $doMimeCheck = !empty(self::$allowedMimeTypes);
$doSizeCheck = self::$maximumFileSize ? TRUE : FALSE; $doSizeCheck = self::$maximumFileSize ? TRUE : FALSE;
//validate //validate

View File

@@ -3,6 +3,7 @@
namespace Maveriks; namespace Maveriks;
use Bootstrap; use Bootstrap;
use Exception;
use G; use G;
use Illuminate\Foundation\Http\Kernel; use Illuminate\Foundation\Http\Kernel;
use Luracast\Restler\Format\UploadFormat; 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 = "") public function loadEnvironment($workspace = "")
{ {
define("PATH_SEP", DIRECTORY_SEPARATOR); define("PATH_SEP", DIRECTORY_SEPARATOR);
@@ -467,24 +478,11 @@ class WebApplication
define("PATH_CONTROLLERS", PATH_CORE . "controllers" . PATH_SEP); define("PATH_CONTROLLERS", PATH_CORE . "controllers" . PATH_SEP);
define("PATH_SERVICES_REST", PATH_CORE . "services" . PATH_SEP . "rest" . 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 * Setting Up Workspace
*/ */
if (!file_exists(FILE_PATHS_INSTALLED)) { 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 // include the server installed configuration
@@ -496,17 +494,58 @@ class WebApplication
define("PATH_TEMPORAL", PATH_C . "dynEditor/"); define("PATH_TEMPORAL", PATH_C . "dynEditor/");
define("PATH_DB", PATH_DATA . "sites" . PATH_SEP); 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 // Change storage path
app()->useStoragePath(realpath(PATH_DATA)); app()->useStoragePath(realpath(PATH_DATA));
app()->make(Kernel::class)->bootstrap(); app()->make(Kernel::class)->bootstrap();
restore_error_handler(); restore_error_handler();
error_reporting(error_reporting() & ~E_STRICT & ~E_DEPRECATED); 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::setLanguage();
Bootstrap::LoadTranslationObject((defined("SYS_LANG")) ? SYS_LANG : "en"); Bootstrap::LoadTranslationObject((defined("SYS_LANG")) ? SYS_LANG : "en");
if (empty($workspace)) { if (empty($workspace)) {
// If the workspace is empty the function should be return the control to the previous file
return true; return true;
} }
@@ -520,24 +559,6 @@ class WebApplication
exit(0); 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"); require_once(PATH_DB . config("system.workspace") . "/db.php");
// defining constant for workspace shared directory // defining constant for workspace shared directory
@@ -591,17 +612,6 @@ class WebApplication
\Propel::init(PATH_CONFIG . "databases.php"); \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(); $oPluginRegistry = PluginRegistry::loadSingleton();
$attributes = $oPluginRegistry->getAttributes(); $attributes = $oPluginRegistry->getAttributes();
Bootstrap::LoadTranslationPlugins(defined('SYS_LANG') ? SYS_LANG : "en", $attributes); 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"; return (isset($arrayConfig["api"]["version"]))? $arrayConfig["api"]["version"] : "1.0";
} catch (\Exception $e) { } catch (Exception $e) {
throw $e; throw $e;
} }
} }

View File

@@ -98,7 +98,9 @@ class MySQLiResultSet extends ResultSetCommon implements ResultSet {
*/ */
public function close() public function close()
{ {
@mysqli_free_result($this->result); if (is_resource($this->result)) {
@mysqli_free_result($this->result);
}
$this->fields = array(); $this->fields = array();
} }

View File

@@ -379,7 +379,13 @@ class DB_mysqli extends DB_common
# need to come up with different means for next line # need to come up with different means for next line
# since $result is object (int)$result won't fly... # since $result is object (int)$result won't fly...
// unset($this->num_rows[(int)$result]); // 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 // free the result only if we were called on a table
if ($got_string) { if ($got_string) {
@mysqli_free_result($id); if (is_resource($id)) {
@mysqli_free_result($id);
}
} }
return $res; return $res;
} }

View File

@@ -90,6 +90,9 @@ try {
$e_all = (defined('E_STRICT'))? $e_all & ~E_STRICT : $e_all; $e_all = (defined('E_STRICT'))? $e_all & ~E_STRICT : $e_all;
$e_all = ($arraySystemConfiguration['debug'])? $e_all : $e_all & ~E_NOTICE; $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()->useStoragePath(realpath(PATH_DATA));
app()->make(Kernel::class)->bootstrap(); app()->make(Kernel::class)->bootstrap();
restore_error_handler(); restore_error_handler();
@@ -100,14 +103,18 @@ try {
ini_set('default_charset', 'UTF-8'); ini_set('default_charset', 'UTF-8');
ini_set('memory_limit', $arraySystemConfiguration['memory_limit']); ini_set('memory_limit', $arraySystemConfiguration['memory_limit']);
ini_set('soap.wsdl_cache_enabled', $arraySystemConfiguration['wsdl_cache']); 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_TIME_LOG', $arraySystemConfiguration['debug_time']);
define('DEBUG_CALENDAR_LOG', $arraySystemConfiguration['debug_calendar']); define('DEBUG_CALENDAR_LOG', $arraySystemConfiguration['debug_calendar']);
define('MEMCACHED_ENABLED', $arraySystemConfiguration['memcached']); define('MEMCACHED_ENABLED', $arraySystemConfiguration['memcached']);
define('MEMCACHED_SERVER', $arraySystemConfiguration['memcached_server']); define('MEMCACHED_SERVER', $arraySystemConfiguration['memcached_server']);
define('TIME_ZONE', ini_get('date.timezone')); define('TIME_ZONE', ini_get('date.timezone'));
date_default_timezone_set(TIME_ZONE);
config(['app.timezone' => TIME_ZONE]);
//CRON command options //CRON command options
$arrayCommandOption = [ $arrayCommandOption = [
@@ -162,9 +169,7 @@ try {
try { try {
$cronSinglePath = PATH_CORE . 'bin' . PATH_SEP . 'cron_single.php'; $cronSinglePath = PATH_CORE . 'bin' . PATH_SEP . 'cron_single.php';
$workspace = ''; $workspace = '';
$dateSystem = date('Y-m-d H:i:s');
$date = ''; $date = '';
$argvx = ''; $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)) { 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 . ']'); eprintln('[Applying date filter: ' . $date . ']');
} else {
$date = $dateSystem;
} }
$counterw = 0; $counterw = 0;
@@ -207,7 +210,7 @@ try {
if (file_exists(PATH_DB . $entry . PATH_SEP . 'db.php')) { if (file_exists(PATH_DB . $entry . PATH_SEP . 'db.php')) {
$counterw++; $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++; $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'); eprintln('Finished ' . $counterw . ' workspaces processed');

View File

@@ -34,7 +34,7 @@ ini_set('memory_limit', '512M');
try { try {
//Verify data //Verify data
if (count($argv) < 8) { if (count($argv) < 7) {
throw new Exception('Error: Invalid number of arguments'); throw new Exception('Error: Invalid number of arguments');
} }
@@ -54,8 +54,7 @@ try {
$pathOutTrunk = $argv[3]; $pathOutTrunk = $argv[3];
$cronName = $argv[4]; $cronName = $argv[4];
$workspace = $argv[5]; $workspace = $argv[5];
$dateSystem = $argv[6]; $now = $argv[6]; //date
$sNow = $argv[7]; //date
//Defines constants //Defines constants
define('PATH_SEP', ($osIsLinux) ? '/' : '\\'); define('PATH_SEP', ($osIsLinux) ? '/' : '\\');
@@ -87,6 +86,9 @@ try {
$e_all = (defined('E_STRICT')) ? $e_all & ~E_STRICT : $e_all; $e_all = (defined('E_STRICT')) ? $e_all & ~E_STRICT : $e_all;
$e_all = ($arraySystemConfiguration['debug']) ? $e_all : $e_all & ~E_NOTICE; $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()->useStoragePath(realpath(PATH_DATA));
app()->make(Kernel::class)->bootstrap(); app()->make(Kernel::class)->bootstrap();
restore_error_handler(); restore_error_handler();
@@ -96,13 +98,18 @@ try {
ini_set('short_open_tag', 'On'); ini_set('short_open_tag', 'On');
ini_set('default_charset', 'UTF-8'); ini_set('default_charset', 'UTF-8');
ini_set('soap.wsdl_cache_enabled', $arraySystemConfiguration['wsdl_cache']); 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_SQL_LOG', $arraySystemConfiguration['debug_sql']);
define('DEBUG_TIME_LOG', $arraySystemConfiguration['debug_time']); define('DEBUG_TIME_LOG', $arraySystemConfiguration['debug_time']);
define('DEBUG_CALENDAR_LOG', $arraySystemConfiguration['debug_calendar']); define('DEBUG_CALENDAR_LOG', $arraySystemConfiguration['debug_calendar']);
define('MEMCACHED_ENABLED', $arraySystemConfiguration['memcached']); define('MEMCACHED_ENABLED', $arraySystemConfiguration['memcached']);
define('MEMCACHED_SERVER', $arraySystemConfiguration['memcached_server']); 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']); spl_autoload_register(['Bootstrap', 'autoloadClass']);
@@ -234,23 +241,9 @@ try {
define('SYS_SKIN', $conf->getConfiguration('SKIN_CRON', '')); define('SYS_SKIN', $conf->getConfiguration('SKIN_CRON', ''));
} }
//Set Time Zone $dateSystem = date('Y-m-d H:i:s');
$systemUtcTimeZone = false; if (empty($now)) {
$now = $dateSystem;
/*----------------------------------********---------------------------------*/
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);
} }
//Processing //Processing
@@ -280,7 +273,7 @@ try {
case 'timereventcron': case 'timereventcron':
$timerEvent = new \ProcessMaker\BusinessModel\TimerEvent(); $timerEvent = new \ProcessMaker\BusinessModel\TimerEvent();
$timerEvent->startContinueCaseByTimerEvent($sNow, true); $timerEvent->startContinueCaseByTimerEvent($now, true);
break; break;
case 'sendnotificationscron': case 'sendnotificationscron':
sendNotifications(); sendNotifications();
@@ -343,7 +336,7 @@ function processWorkspace()
function resendEmails() function resendEmails()
{ {
global $argvx; global $argvx;
global $sNow; global $now;
global $dateSystem; global $dateSystem;
if ($argvx != "" && strpos($argvx, "emails") === false) { if ($argvx != "" && strpos($argvx, "emails") === false) {
@@ -353,9 +346,9 @@ function resendEmails()
setExecutionMessage("Resending emails"); setExecutionMessage("Resending emails");
try { try {
$dateResend = $sNow; $dateResend = $now;
if ($sNow == $dateSystem) { if ($now == $dateSystem) {
$arrayDateSystem = getdate(strtotime($dateSystem)); $arrayDateSystem = getdate(strtotime($dateSystem));
$mktDateSystem = mktime( $mktDateSystem = mktime(
@@ -408,7 +401,7 @@ function resendEmails()
function unpauseApplications() function unpauseApplications()
{ {
global $argvx; global $argvx;
global $sNow; global $now;
if ($argvx != "" && strpos($argvx, "unpause") === false) { if ($argvx != "" && strpos($argvx, "unpause") === false) {
return false; return false;
@@ -418,7 +411,7 @@ function unpauseApplications()
try { try {
$oCases = new Cases(); $oCases = new Cases();
$oCases->ThrowUnpauseDaemon($sNow, 1); $oCases->ThrowUnpauseDaemon($now, 1);
setExecutionResultMessage('DONE'); setExecutionResultMessage('DONE');
saveLog('unpauseApplications', 'action', 'Unpausing Applications'); saveLog('unpauseApplications', 'action', 'Unpausing Applications');
@@ -552,10 +545,10 @@ function calculateAppDuration()
} }
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/
function executeEvents($sLastExecution, $sNow = null) function executeEvents($sLastExecution, $now = null)
{ {
global $argvx; global $argvx;
global $sNow; global $now;
$log = array(); $log = array();
@@ -568,15 +561,15 @@ function executeEvents($sLastExecution, $sNow = null)
try { try {
$oAppEvent = new AppEvent(); $oAppEvent = new AppEvent();
saveLog('executeEvents', 'action', "Executing Events $sLastExecution, $sNow "); saveLog('executeEvents', 'action', "Executing Events $sLastExecution, $now ");
$n = $oAppEvent->executeEvents($sNow, false, $log, 1); $n = $oAppEvent->executeEvents($now, false, $log, 1);
foreach ($log as $value) { foreach ($log as $value) {
$arrayCron = unserialize(trim(@file_get_contents(PATH_DATA . "cron"))); $arrayCron = unserialize(trim(@file_get_contents(PATH_DATA . "cron")));
$arrayCron["processcTimeStart"] = time(); $arrayCron["processcTimeStart"] = time();
@file_put_contents(PATH_DATA . "cron", serialize($arrayCron)); @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"); setExecutionMessage("|- End Execution events");
@@ -588,11 +581,11 @@ function executeEvents($sLastExecution, $sNow = null)
} }
} }
function executeScheduledCases($sNow = null) function executeScheduledCases($now = null)
{ {
try { try {
global $argvx; global $argvx;
global $sNow; global $now;
$log = array(); $log = array();
if ($argvx != "" && strpos($argvx, "scheduler") === false) { if ($argvx != "" && strpos($argvx, "scheduler") === false) {
@@ -603,7 +596,7 @@ function executeScheduledCases($sNow = null)
setExecutionResultMessage('PROCESSING'); setExecutionResultMessage('PROCESSING');
$oCaseScheduler = new CaseScheduler(); $oCaseScheduler = new CaseScheduler();
$oCaseScheduler->caseSchedulerCron($sNow, $log, 1); $oCaseScheduler->caseSchedulerCron($now, $log, 1);
foreach ($log as $value) { foreach ($log as $value) {
$arrayCron = unserialize(trim(@file_get_contents(PATH_DATA . "cron"))); $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() function executeUpdateAppTitle()
{ {
try { try {

View File

@@ -7514,5 +7514,183 @@ class Cases
$caseDataRow["USR_UID"] = $targetUserId; $caseDataRow["USR_UID"] = $targetUserId;
$listInbox->create($caseDataRow); $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;
}
} }

View File

@@ -944,6 +944,8 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
* *
* @param string resource path to check for locks * @param string resource path to check for locks
* @return bool true on success * @return bool true on success
* @link https://wiki.processmaker.com/index.php/WebDAV
* @deprecated
*/ */
public function checkLock($path) public function checkLock($path)
{ {
@@ -959,7 +961,9 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server
if ($res) { if ($res) {
$row = mysqli_fetch_array($res); $row = mysqli_fetch_array($res);
mysqli_free_result($res); if (is_resource($res)) {
mysqli_free_result($res);
}
if ($row) { if ($row) {
$result = array("type" => "write", "scope" => $row["exclusivelock"] ? "exclusive" : "shared", "depth" => 0, "owner" => $row['owner'], "token" => $row['token'], "expires" => $row['expires'] $result = array("type" => "write", "scope" => $row["exclusivelock"] ? "exclusive" : "shared", "depth" => 0, "owner" => $row['owner'], "token" => $row['token'], "expires" => $row['expires']

View File

@@ -15269,6 +15269,12 @@ msgstr "Screenshot640"
msgid "The input document is required, please select the value." msgid "The input document is required, please select the value."
msgstr "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 # TRANSLATION
# LABEL/ID_MAFE_99b2439e63f73ad515f7ab2447a80673 # LABEL/ID_MAFE_99b2439e63f73ad515f7ab2447a80673
#: LABEL/ID_MAFE_99b2439e63f73ad515f7ab2447a80673 #: LABEL/ID_MAFE_99b2439e63f73ad515f7ab2447a80673
@@ -15653,6 +15659,12 @@ msgstr "Ok"
msgid "Notify the assigned user to this task" msgid "Notify the assigned user to this task"
msgstr "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 # TRANSLATION
# LABEL/ID_MAFE_a6527af0da63377b07a3effae750a485 # LABEL/ID_MAFE_a6527af0da63377b07a3effae750a485
#: 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" msgid "Invalid operation: Delete message flow before converting it to"
msgstr "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 # TRANSLATION
# LABEL/ID_MAFE_c5f93fd19468533ea5c9114801c2958d # LABEL/ID_MAFE_c5f93fd19468533ea5c9114801c2958d
#: 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." msgid "Please configure script to wait for a signal."
msgstr "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 # TRANSLATION
# LABEL/ID_MAFE_e2b9d6eb9f3ec7d4e6089274a4481fab # LABEL/ID_MAFE_e2b9d6eb9f3ec7d4e6089274a4481fab
#: LABEL/ID_MAFE_e2b9d6eb9f3ec7d4e6089274a4481fab #: LABEL/ID_MAFE_e2b9d6eb9f3ec7d4e6089274a4481fab
@@ -17807,6 +17831,12 @@ msgstr "Assignment"
msgid "EXCLUSIVE" msgid "EXCLUSIVE"
msgstr "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 # TRANSLATION
# LABEL/ID_MAFE_f4636507ca93332f92f92fb219a43b02 # LABEL/ID_MAFE_f4636507ca93332f92f92fb219a43b02
#: 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" msgid "The default configuration was not defined"
msgstr "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 # TRANSLATION
# LABEL/ID_THE_MIMETYPE_EXTENSION_ERROR # LABEL/ID_THE_MIMETYPE_EXTENSION_ERROR
#: LABEL/ID_THE_MIMETYPE_EXTENSION_ERROR #: LABEL/ID_THE_MIMETYPE_EXTENSION_ERROR

View File

@@ -11,9 +11,10 @@ use ProcessMaker\Plugins\PluginRegistry;
*/ */
use Maveriks\Util\ClassLoader; use Maveriks\Util\ClassLoader;
use \OAuth2\Request; use OAuth2\Request;
use \ProcessMaker\BusinessModel\Light\Tracker; use ProcessMaker\BusinessModel\InputDocument;
use \ProcessMaker\Services\OAuth2\Server; use ProcessMaker\BusinessModel\Light\Tracker;
use ProcessMaker\Services\OAuth2\Server;
class Designer extends Controller class Designer extends Controller
{ {
@@ -27,6 +28,8 @@ class Designer extends Controller
* Index Action * Index Action
* *
* @param string $httpData (opional) * @param string $httpData (opional)
*
* @see Controller->call()
*/ */
public function index($httpData) public function index($httpData)
{ {
@@ -65,6 +68,8 @@ class Designer extends Controller
$this->setVar("SYS_LANG", SYS_LANG); $this->setVar("SYS_LANG", SYS_LANG);
$this->setVar("SYS_SKIN", SYS_SKIN); $this->setVar("SYS_SKIN", SYS_SKIN);
$this->setVar('HTTP_SERVER_HOSTNAME', System::getHttpServerHostnameRequestsFrontEnd()); $this->setVar('HTTP_SERVER_HOSTNAME', System::getHttpServerHostnameRequestsFrontEnd());
$inpuDocument = new InputDocument();
$this->setVar('maxFileSizeInformation', G::json_encode($inpuDocument->getMaxFileSize()));
if ($debug) { if ($debug) {
if (!file_exists(PATH_HTML . "lib-dev/pmUI/build.cache")) { if (!file_exists(PATH_HTML . "lib-dev/pmUI/build.cache")) {

View File

@@ -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_9925fd3c9d09e862da22c5d6912420d9','en','End event must have an incoming sequence flow', NOW()) ,
( 'LABEL','ID_MAFE_992d1d47106d77216cd6c3a15415dbea','en','Screenshot640', 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_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_99b2439e63f73ad515f7ab2447a80673','en','PAUSED', NOW()) ,
( 'LABEL','ID_MAFE_99c293babcada00063dd86b4f53bccd7','en','Variable sent in email', NOW()) , ( 'LABEL','ID_MAFE_99c293babcada00063dd86b4f53bccd7','en','Variable sent in email', NOW()) ,
( 'LABEL','ID_MAFE_9a0364b9e99bb480dd25e1f0284c8555','en','content', 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_a603905470e2a5b8c13e96b579ef0dba','en','Debug', NOW()) ,
( 'LABEL','ID_MAFE_a60852f204ed8028c1c58808b746d115','en','Ok', NOW()) , ( 'LABEL','ID_MAFE_a60852f204ed8028c1c58808b746d115','en','Ok', NOW()) ,
( 'LABEL','ID_MAFE_a60cf2ece5b3e294aa794916477ac6a8','en','Notify the assigned user to this task', 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','<br/>Triggers: Create scripts.', NOW()) , ( 'LABEL','ID_MAFE_a6527af0da63377b07a3effae750a485','en','<br/>Triggers: Create scripts.', NOW()) ,
( 'LABEL','ID_MAFE_a6c0580005d36b8ad4194b3b31cdb9ee','en','Input Document deleted successfully', NOW()) , ( 'LABEL','ID_MAFE_a6c0580005d36b8ad4194b3b31cdb9ee','en','Input Document deleted successfully', NOW()) ,
( 'LABEL','ID_MAFE_a6ca4597da3795aed1b1fa92f0e8d9a6','en','Previous Decade', 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_c53385d51221bcb27c5f37de31043c24','en','No Category', NOW()) ,
( 'LABEL','ID_MAFE_c5bcf625cbb751aba886be634ef4ef47','en','Invalid Connection between elements', 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_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_c5f93fd19468533ea5c9114801c2958d','en','Input Document updated successfully', NOW()) ,
( 'LABEL','ID_MAFE_c61404957758dfda283709e89376ab3e','en','layout', NOW()) , ( 'LABEL','ID_MAFE_c61404957758dfda283709e89376ab3e','en','layout', NOW()) ,
( 'LABEL','ID_MAFE_c61dee25881b22ead46aca2bc70f0f9d','en','Assigned supervisors list', 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_e2627d9094274c7bcdc01ce1dadbaaab','en','Select Target Process', NOW()) ,
( 'LABEL','ID_MAFE_e29d57981d438d31f08b968bb12ed568','en','Select a Control', 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_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_e2b9d6eb9f3ec7d4e6089274a4481fab','en','There are problems getting the list of DynaForms, please try again.', NOW()) ,
( 'LABEL','ID_MAFE_e30f555e5a24f076a5d5be70a4625270','en','TNS', NOW()) , ( 'LABEL','ID_MAFE_e30f555e5a24f076a5d5be70a4625270','en','TNS', NOW()) ,
( 'LABEL','ID_MAFE_e3ce9b91bd7b1be415b5e687006ad179','en','false: No default selection <br>true: current date<br>year: the first day of the current year<br>month: the first day of the month<br>day: the current day<br>hour: the current hour without minutes<br>minute: the current minute', NOW()) , ( 'LABEL','ID_MAFE_e3ce9b91bd7b1be415b5e687006ad179','en','false: No default selection <br>true: current date<br>year: the first day of the current year<br>month: the first day of the month<br>day: the current day<br>hour: the current hour without minutes<br>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_f3a29486bed19a90f2da6d007818b427','en','Steps', NOW()) ,
( 'LABEL','ID_MAFE_f3b92fc0f97f128818cfb44321376bca','en','Assignment', NOW()) , ( 'LABEL','ID_MAFE_f3b92fc0f97f128818cfb44321376bca','en','Assignment', NOW()) ,
( 'LABEL','ID_MAFE_f45c3a0bb3687ed8e221253b3fd4a2ce','en','EXCLUSIVE', 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_f4636507ca93332f92f92fb219a43b02','en','Database Connection', NOW()) ,
( 'LABEL','ID_MAFE_f49b52022300199128ed01380edda751','en','There are problems updating the Timer Event, please try again.', 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()) , ( '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_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_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_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_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_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') , ( 'LABEL','ID_THE_PHP_FILES_EXECUTION_WAS_DISABLED','en','The PHP files execution was disabled please contact the system administrator.','2018-04-20') ,

View File

@@ -2,24 +2,17 @@
/** /**
* cases_Open.php * cases_Open.php
* *
* ProcessMaker Open Source Edition * @see cases/casesList.js
* Copyright (C) 2004 - 2008 Colosa Inc. * @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 * @link https://wiki.processmaker.com/3.2/Cases/Cases#Search_Criteria
* 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 <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/ */
if(isset( $_GET['gmail']) && $_GET['gmail'] == 1){ if(isset( $_GET['gmail']) && $_GET['gmail'] == 1){
@@ -50,7 +43,8 @@ try {
//Loading data for a Jump request //Loading data for a Jump request
if (!isset($_GET['APP_UID']) && isset($_GET['APP_NUMBER'])) { if (!isset($_GET['APP_UID']) && isset($_GET['APP_NUMBER'])) {
$_GET['APP_UID'] = $caseInstance->getApplicationUIDByNumber( $_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 the application doesn't exist
if (is_null($_GET['APP_UID'])) { if (is_null($_GET['APP_UID'])) {
@@ -67,87 +61,86 @@ try {
} }
} }
$sAppUid = $_GET['APP_UID']; $appUid = $_GET['APP_UID'];
$iDelIndex = $_GET['DEL_INDEX']; $delIndex = $_GET['DEL_INDEX'];
$_action = isset($_GET['action']) ? $_GET['action'] : ''; $action = isset($_GET['action']) ? $_GET['action'] : '';
//loading application data //loading application data
$aFields = $caseInstance->loadCase( $sAppUid, $iDelIndex ); $fieldCase = $caseInstance->loadCase($appUid, $delIndex);
if (!isset($_SESSION['CURRENT_TASK'])) { if (!isset($_SESSION['CURRENT_TASK'])) {
$_SESSION['CURRENT_TASK'] = $aFields['TAS_UID']; $_SESSION['CURRENT_TASK'] = $fieldCase['TAS_UID'];
} elseif ($_SESSION['CURRENT_TASK'] == '') { } elseif ($_SESSION['CURRENT_TASK'] == '') {
$_SESSION['CURRENT_TASK'] = $aFields['TAS_UID']; $_SESSION['CURRENT_TASK'] = $fieldCase['TAS_UID'];
} }
unset($_SESSION['ACTION']); unset($_SESSION['ACTION']);
$flagJump = ''; $flagJump = '';
if ($_action == 'jump') { if ($action == 'jump') {
$_SESSION['ACTION'] = 'jump'; $_SESSION['ACTION'] = 'jump';
$flagJump = 1; $flagJump = 1;
} }
switch ($aFields['APP_STATUS']) { switch ($fieldCase['APP_STATUS']) {
case 'DRAFT': case 'DRAFT':
case 'TO_DO': case 'TO_DO':
//Check if the case is in pause, check a valid record in table APP_DELAY //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 //Check if the case is a waiting for a SYNCHRONOUS subprocess
$subAppData = new \SubApplication(); $subAppData = new SubApplication();
$caseSubprocessPending = $subAppData->isSubProcessWithCasePending($sAppUid, $iDelIndex); $caseSubprocessPending = $subAppData->isSubProcessWithCasePending($appUid, $delIndex);
if ($isPaused || $caseSubprocessPending) { if ($isPaused || $caseSubprocessPending) {
//the case is paused show only the resume //the case is paused show only the resume
$_SESSION['APPLICATION'] = $sAppUid; $_SESSION['APPLICATION'] = $appUid;
$_SESSION['INDEX'] = $iDelIndex; $_SESSION['INDEX'] = $delIndex;
$_SESSION['PROCESS'] = $aFields['PRO_UID']; $_SESSION['PROCESS'] = $fieldCase['PRO_UID'];
$_SESSION['TASK'] = - 1; $_SESSION['TASK'] = -1;
$_SESSION['STEP_POSITION'] = 0; $_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(); exit();
} }
/** /**
* these routine is to verify if the case was acceded from advanced search list * 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 //verify if the case is with the current user
$aData = AppDelegation::getCurrentUsers($sAppUid, $iDelIndex); $delegationUsers = AppDelegation::getCurrentUsers($appUid, $delIndex);
if ($aData['USR_UID'] !== $_SESSION['USER_LOGGED'] && !empty($aData['USR_UID'])) { if ($delegationUsers['USR_UID'] !== $_SESSION['USER_LOGGED'] && !empty($delegationUsers['USR_UID'])) {
//distinct "" for selfservice //distinct "" for selfservice
//so we show just the resume //so we show just the resume
$_SESSION['alreadyDerivated'] = true; $_SESSION['alreadyDerivated'] = true;
$_SESSION['APPLICATION'] = $sAppUid; $_SESSION['APPLICATION'] = $appUid;
$_SESSION['INDEX'] = $iDelIndex; $_SESSION['INDEX'] = $delIndex;
$_SESSION['PROCESS'] = $aFields['PRO_UID']; $_SESSION['PROCESS'] = $fieldCase['PRO_UID'];
$_SESSION['TASK'] = - 1; $_SESSION['TASK'] = -1;
$_SESSION['STEP_POSITION'] = 0; $_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(); exit();
} }
} }
//proceed and try to open the case //Proceed and try to open the case
$oAppDelegation = new AppDelegation(); $appDelegation = new AppDelegation();
$aDelegation = $oAppDelegation->load( $sAppUid, $iDelIndex ); $delegationInfo = $appDelegation->load($appUid, $delIndex);
//if there are no user in the delegation row, this case is in selfservice //If there are no user in the delegation row, this case is in selfservice
if ($aDelegation['USR_UID'] == "") { if (empty($delegationInfo['USR_UID'])) {
$_SESSION['APPLICATION'] = $sAppUid; $_SESSION['APPLICATION'] = $appUid;
$_SESSION['INDEX'] = $iDelIndex; $_SESSION['INDEX'] = $delIndex;
$_SESSION['PROCESS'] = $aFields['PRO_UID']; $_SESSION['PROCESS'] = $fieldCase['PRO_UID'];
$_SESSION['TASK'] = - 1; $_SESSION['TASK'] = -1;
$_SESSION['STEP_POSITION'] = 0; $_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 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 ($caseInstance->isSelfService($_SESSION['USER_LOGGED'], $fieldCase['TAS_UID'], $appUid)) {
require_once(PATH_METHODS . 'cases' . PATH_SEP . 'cases_CatchSelfService.php'); require_once(PATH_METHODS . 'cases' . PATH_SEP . 'cases_CatchSelfService.php');
} else { } else {
require_once(PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php'); require_once(PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php');
@@ -156,49 +149,56 @@ try {
exit(); exit();
} }
//If the current users is in the AppDelegation row, then open the case //If the current users is in the AppDelegation row and the thread is open will be open the case
if (($aDelegation['USR_UID'] == $_SESSION['USER_LOGGED']) && $_action != 'sent') { if (($delegationInfo['USR_UID'] == $_SESSION['USER_LOGGED'] && $delegationInfo['DEL_THREAD_STATUS'] === 'OPEN')
$_SESSION['APPLICATION'] = $sAppUid; && $action != 'sent')
$_SESSION['INDEX'] = $iDelIndex; {
$_SESSION['APPLICATION'] = $appUid;
$_SESSION['INDEX'] = $delIndex;
if (is_null( $aFields['DEL_INIT_DATE'] )) { if (is_null($fieldCase['DEL_INIT_DATE'])) {
$caseInstance->setDelInitDate( $sAppUid, $iDelIndex ); $caseInstance->setDelInitDate($appUid, $delIndex);
$aFields = $caseInstance->loadCase( $sAppUid, $iDelIndex ); $fieldCase = $caseInstance->loadCase($appUid, $delIndex);
} }
$_SESSION['PROCESS'] = $aFields['PRO_UID']; $_SESSION['PROCESS'] = $fieldCase['PRO_UID'];
$_SESSION['TASK'] = $aFields['TAS_UID']; $_SESSION['TASK'] = $fieldCase['TAS_UID'];
$_SESSION['STEP_POSITION'] = 0; $_SESSION['STEP_POSITION'] = 0;
/* Redirect to next step */ /* Redirect to next step */
unset( $_SESSION['bNoShowSteps'] ); unset($_SESSION['bNoShowSteps']);
/* Execute Before Triggers for first Task*/ /** Execute a trigger when a case is open */
$caseInstance->getExecuteTriggerProcess($sAppUid, 'OPEN'); $caseInstance->getExecuteTriggerProcess($appUid, 'OPEN');
/*end Execute Before Triggers for first Task*/
$aNextStep = $caseInstance->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] ); $nextStep = $caseInstance->getNextStep(
$sPage = $aNextStep['PAGE']; $_SESSION['PROCESS'],
G::header( 'location: ' . $sPage ); $_SESSION['APPLICATION'],
$_SESSION['INDEX'],
$_SESSION['STEP_POSITION']
);
$pageOpenCase = $nextStep['PAGE'];
G::header('location: ' . $pageOpenCase);
} else { } else {
$_SESSION['APPLICATION'] = $sAppUid; $_SESSION['APPLICATION'] = $appUid;
$_SESSION['PROCESS'] = $aFields['PRO_UID']; $_SESSION['PROCESS'] = $fieldCase['PRO_UID'];
$_SESSION['TASK'] = - 1; $_SESSION['TASK'] = -1;
$_SESSION['bNoShowSteps'] = 1; $_SESSION['bNoShowSteps'] = 1;
$_SESSION['STEP_POSITION'] = 0; $_SESSION['STEP_POSITION'] = 0;
//When the case have another user or current user doesn't have rights to this self-service, //When the case have another user or current user doesn't have rights to this self-service,
//Just view the case Resume //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 //We need to use the index sent with the corresponding record
$_SESSION['INDEX'] = $iDelIndex; $_SESSION['INDEX'] = $delIndex;
} else { } else {
//Get DEL_INDEX //Get DEL_INDEX
$criteria = new Criteria('workflow'); $criteria = new Criteria('workflow');
$criteria->addSelectColumn(AppDelegationPeer::DEL_INDEX); $criteria->addSelectColumn(AppDelegationPeer::DEL_INDEX);
$criteria->add(AppDelegationPeer::APP_UID, $sAppUid); $criteria->add(AppDelegationPeer::APP_UID, $appUid);
$criteria->add(AppDelegationPeer::DEL_LAST_INDEX , 1); $criteria->add(AppDelegationPeer::DEL_LAST_INDEX, 1);
$rs = AppDelegationPeer::doSelectRS($criteria); $rs = AppDelegationPeer::doSelectRS($criteria);
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$rs->next(); $rs->next();
@@ -206,29 +206,29 @@ try {
$_SESSION['INDEX'] = $row['DEL_INDEX']; $_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; break;
default: //APP_STATUS IS COMPLETED OR CANCELLED default: //APP_STATUS IS COMPLETED OR CANCELLED
$_SESSION['APPLICATION'] = $sAppUid; $_SESSION['APPLICATION'] = $appUid;
$_SESSION['INDEX'] = $caseInstance->getCurrentDelegationCase( $_GET['APP_UID'] ); $_SESSION['INDEX'] = $caseInstance->getCurrentDelegationCase($_GET['APP_UID']);
$_SESSION['PROCESS'] = $aFields['PRO_UID']; $_SESSION['PROCESS'] = $fieldCase['PRO_UID'];
$_SESSION['TASK'] = - 1; $_SESSION['TASK'] = -1;
$_SESSION['STEP_POSITION'] = 0; $_SESSION['STEP_POSITION'] = 0;
$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');
} }
} catch (Exception $e) { } catch (Exception $e) {
$aMessage = array (); $message = [];
$aMessage['MESSAGE'] = $e->getMessage(); $message['MESSAGE'] = $e->getMessage();
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage ); $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $message);
G::RenderPage( 'publishBlank', 'blank' ); G::RenderPage('publishBlank', 'blank');
} }

View File

@@ -1,26 +1,7 @@
<?php <?php
/**
* cases_SaveData.php use ProcessMaker\Validation\ValidationUploadedFiles;
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.
*
* 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 <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
//validate the data post //validate the data post
if (!isset($_SESSION['USER_LOGGED'])) { if (!isset($_SESSION['USER_LOGGED'])) {
if(!strpos($_SERVER['REQUEST_URI'], 'gmail')) { if(!strpos($_SERVER['REQUEST_URI'], 'gmail')) {
@@ -69,32 +50,12 @@ if (!isset($_SESSION['USER_LOGGED'])) {
} }
} }
/** ValidationUploadedFiles::getValidationUploadedFiles()->dispatch(function($validator) {
* If you can, you may want to set post_max_size to a low value (say 1M) to make G::SendMessageText($validator->getMessage(), "ERROR");
* testing easier. First test to see how your script behaves. Try uploading a file $url = explode("sys" . config("system.workspace"), $_SERVER['HTTP_REFERER']);
* that is larger than post_max_size. If you do you will get a message like this G::header("location: " . "/sys" . config("system.workspace") . $url[1]);
* 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');
die(); die();
} });
try { try {
if ($_GET['APP_UID'] !== $_SESSION['APPLICATION']) { if ($_GET['APP_UID'] !== $_SESSION['APPLICATION']) {

View File

@@ -1,4 +1,21 @@
<?php <?php
/**
* open.php
*
* @see cases/casesStartPage_Ajax.php
* @see cases/cases_CatchExecute.php
* @see cases/main_init.php
*
* @see dataReportingTools/public_html/js/reportViewer.js
* @see EnterpriseSearch/dynaform_view.js
*
* @link https://wiki.processmaker.com/3.2/Cases/Cases#Search_Criteria
* @link https://wiki.processmaker.com/3.2/Cases/Cases#Inbox
* @link https://wiki.processmaker.com/3.2/Cases/Cases#New_Case
*/
use ProcessMaker\BusinessModel\Cases as BmCases;
use ProcessMaker\BusinessModel\ProcessSupervisor;
$tBarGmail = false; $tBarGmail = false;
if (isset($_GET['gmail']) && $_GET['gmail'] == 1) { if (isset($_GET['gmail']) && $_GET['gmail'] == 1) {
@@ -12,18 +29,18 @@ if (!isset($_GET['APP_UID']) && !isset($_GET['APP_NUMBER']) && !isset($_GET['DEL
} }
//Get the APP_UID related to APP_NUMBER //Get the APP_UID related to APP_NUMBER
if (!isset($_GET['APP_UID']) && isset($_GET['APP_NUMBER'])) { if (!isset($_GET['APP_UID']) && isset($_GET['APP_NUMBER'])) {
$oCase = new Cases(); $caseInstance = new Cases();
$appUid = $oCase->getApplicationUIDByNumber(htmlspecialchars($_GET['APP_NUMBER'])); $appUid = $caseInstance->getApplicationUIDByNumber(htmlspecialchars($_GET['APP_NUMBER']));
if (is_null($appUid)) { if (is_null($appUid)) {
throw new Exception(G::LoadTranslation('ID_CASE_DOES_NOT_EXISTS')); throw new Exception(G::LoadTranslation('ID_CASE_DOES_NOT_EXISTS'));
} }
} else { } else {
$appUid = htmlspecialchars($_GET['APP_UID']); $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'])) { if (!isset($_GET['DEL_INDEX'])) {
$oCase = new Cases(); $caseInstance = new Cases();
$delIndex = $oCase->getCurrentDelegation($appUid, $_SESSION['USER_LOGGED']); $delIndex = $caseInstance->getCurrentDelegation($appUid, $_SESSION['USER_LOGGED']);
if (is_null($delIndex)) { if (is_null($delIndex)) {
throw new Exception(G::LoadTranslation('ID_CASE_IS_CURRENTLY_WITH_ANOTHER_USER')); 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']) : ''; $tasUid = (isset($_GET['TAS_UID'])) ? $tasUid = htmlspecialchars($_GET['TAS_UID']) : '';
$oCase = new Cases(); $caseInstance = new Cases();
$conf = new Configurations(); $conf = new Configurations();
$headPublisher = headPublisher::getSingleton();
$oHeadPublisher = headPublisher::getSingleton();
$urlToRedirectAfterPause = 'casesListExtJs'; $urlToRedirectAfterPause = 'casesListExtJs';
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/
$licensedFeatures = PMLicensedFeatures::getSingleton(); $licensedFeatures = PMLicensedFeatures::getSingleton();
if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) { if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
@@ -52,78 +67,110 @@ if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
} }
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/
$headPublisher->assign('urlToRedirectAfterPause', $urlToRedirectAfterPause);
$oHeadPublisher->assign('urlToRedirectAfterPause', $urlToRedirectAfterPause); $headPublisher->addExtJsScript('app/main', true);
$headPublisher->addExtJsScript('cases/open', true);
$headPublisher->assign('FORMATS', $conf->getFormats());
$oHeadPublisher->addExtJsScript('app/main', true);
$oHeadPublisher->addExtJsScript('cases/open', true);
$oHeadPublisher->assign('FORMATS', $conf->getFormats());
$uri = ''; $uri = '';
foreach ($_GET as $k => $v) { foreach ($_GET as $k => $v) {
$uri .= ($uri == '') ? "$k=$v" : "&$k=$v"; $uri .= ($uri == '') ? "$k=$v" : "&$k=$v";
} }
if (isset($_GET['action']) && ($_GET['action'] == 'jump')) { /**
$oNewCase = new \ProcessMaker\BusinessModel\Cases(); * @todo, the action over the case from Open Case, Case Link and jump to needs to work similar, we need to have a PRD
//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 = $caseInstance->loadCase($appUid, $delIndex);
$case = $oCase->loadCase($appUid, $delIndex, $_GET['action']); $canClaimCase = false;
} else { $caseCanBeReview = false;
$case = $oCase->loadCase($appUid, $delIndex); 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(); * Review if the user can be open the case from Review list
$caseCanBeReview = $oSupervisor->reviewCaseStatusForSupervisor($appUid, $delIndex); * @link https://wiki.processmaker.com/3.2/Cases/Process_Supervisor#Review
//Check if the case has the correct status for update the information from supervisor/review */
if (!$caseCanBeReview) { if (!$caseCanBeReview) {
//The supervisor can not edit the information //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 "<div id='toReviseTree'></div>";
}
} else {
$script = 'cases_Open?'; $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 "<div id='toReviseTree'></div>";
} }
$process = new Process(); $process = new Process();
$fields = $process->load($case['PRO_UID']); $fields = $process->load($case['PRO_UID']);
$isBpmn = $fields['PRO_BPMN'] === 1 ? true : false; $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; $showCustomForm = false;
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/
$respView = $caseInstance->getAllObjectsFrom($case['PRO_UID'], $appUid, $case['TAS_UID'], $_SESSION['USER_LOGGED'], 'VIEW');
$respView = $oCase->getAllObjectsFrom($case['PRO_UID'], $appUid, $case['TAS_UID'], $_SESSION['USER_LOGGED'], 'VIEW');
$viewSummaryForm = isset($respView['SUMMARY_FORM']) && $respView['SUMMARY_FORM'] === 1 ? true : false; $viewSummaryForm = isset($respView['SUMMARY_FORM']) && $respView['SUMMARY_FORM'] === 1 ? true : false;
$isNoEmpty = isset($fields['PRO_DYNAFORMS']['PROCESS']) && !empty($fields['PRO_DYNAFORMS']['PROCESS']); $isNoEmpty = isset($fields['PRO_DYNAFORMS']['PROCESS']) && !empty($fields['PRO_DYNAFORMS']['PROCESS']);
if ($isBpmn && $viewSummaryForm && $isNoEmpty) { if ($isBpmn && $viewSummaryForm && $isNoEmpty) {
$showCustomForm = true; $showCustomForm = true;
} }
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/
$oStep = new Step(); $step = new Step();
$oStep = $oStep->loadByProcessTaskPosition($case['PRO_UID'], $case['TAS_UID'], 1); $step = $step->loadByProcessTaskPosition($case['PRO_UID'], $case['TAS_UID'], 1);
$oHeadPublisher->assign('uri', $script . $uri); $headPublisher->assign('uri', $script . $uri);
$oHeadPublisher->assign('_APP_NUM', '#: ' . $case['APP_NUMBER']); $headPublisher->assign('_APP_NUM', '#: ' . $case['APP_NUMBER']);
$oHeadPublisher->assign('_PROJECT_TYPE', $isBpmn ? 'bpmn' : 'classic'); $headPublisher->assign('_PROJECT_TYPE', $isBpmn ? 'bpmn' : 'classic');
$oHeadPublisher->assign('_PRO_UID', $case['PRO_UID']); $headPublisher->assign('_PRO_UID', $case['PRO_UID']);
$oHeadPublisher->assign('_APP_UID', $appUid); $headPublisher->assign('_APP_UID', $appUid);
$oHeadPublisher->assign('_ENV_CURRENT_DATE', $conf->getSystemDate(date('Y-m-d'))); $headPublisher->assign('_ENV_CURRENT_DATE', $conf->getSystemDate(date('Y-m-d')));
$oHeadPublisher->assign('_ENV_CURRENT_DATE_NO_FORMAT', date('Y-m-d-h-i-A')); $headPublisher->assign('_ENV_CURRENT_DATE_NO_FORMAT', date('Y-m-d-h-i-A'));
$oHeadPublisher->assign('idfirstform', is_null($oStep) ? '-1' : $oStep->getStepUidObj()); $headPublisher->assign('idfirstform', is_null($step) ? '-1' : $step->getStepUidObj());
$oHeadPublisher->assign('appStatus', $case['APP_STATUS']); $headPublisher->assign('appStatus', $case['APP_STATUS']);
$oHeadPublisher->assign('tbarGmail', $tBarGmail); $headPublisher->assign('tbarGmail', $tBarGmail);
$oHeadPublisher->assign('showCustomForm', $showCustomForm); $headPublisher->assign('showCustomForm', $showCustomForm);
$headPublisher->assign('canClaimCase', $canClaimCase);
if (!isset($_SESSION['APPLICATION']) || !isset($_SESSION['TASK']) || !isset($_SESSION['INDEX'])) { if (!isset($_SESSION['APPLICATION']) || !isset($_SESSION['TASK']) || !isset($_SESSION['INDEX'])) {
$_SESSION['PROCESS'] = $case['PRO_UID']; $_SESSION['PROCESS'] = $case['PRO_UID'];

View File

@@ -1,5 +1,10 @@
<?php <?php
/**
* @see workflow/engine/methods/services/ActionsByEmailDataForm.php
* @link https://wiki.processmaker.com/3.3/Actions_by_Email#Link_to_Fill_a_Form
*/
use ProcessMaker\ChangeLog\ChangeLog; use ProcessMaker\ChangeLog\ChangeLog;
if (PMLicensedFeatures::getSingleton() if (PMLicensedFeatures::getSingleton()
@@ -103,6 +108,11 @@ if (PMLicensedFeatures::getSingleton()
if (isset($_FILES ['form'])) { if (isset($_FILES ['form'])) {
if (isset($_FILES["form"]["name"]) && count($_FILES["form"]["name"]) > 0) { if (isset($_FILES["form"]["name"]) && count($_FILES["form"]["name"]) > 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 = new \ProcessMaker\BusinessModel\Cases\InputDocument();
$oInputDocument->uploadFileCase($_FILES, $case, $casesFields, $currentUsrUid, $appUid, $delIndex); $oInputDocument->uploadFileCase($_FILES, $case, $casesFields, $currentUsrUid, $appUid, $delIndex);
} }

View File

@@ -2128,6 +2128,11 @@ class Cases
* *
* @param string $applicationUid Unique id of Case * @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 * @return array Return an array with all Tasks of Case
* @throws Exception * @throws Exception
*/ */
@@ -2151,33 +2156,20 @@ class Cases
$taskUid = ""; $taskUid = "";
//Get data //Obtain the list of tasks and their respectives users assigned to each one for an specific case
//SQL $case = new ClassesCases();
$delimiter = DBAdapter::getStringDelimiter(); $rsTasks = $case->getTasksInfoForACase($applicationUid, $processUid);
$criteria = new Criteria("workflow"); while ($rsTasks->next()) {
$row = $rsTasks->getRow();
$criteria->addSelectColumn(TaskPeer::TAS_UID); //If the task is a multiple task
$criteria->addSelectColumn(TaskPeer::TAS_TITLE); if ($row["TAS_ASSIGN_TYPE"] == 'MULTIPLE_INSTANCE' || $row["TAS_ASSIGN_TYPE"] == 'MULTIPLE_INSTANCE_VALUE_BASED') {
$criteria->addSelectColumn(TaskPeer::TAS_DESCRIPTION); $row["USR_UID"] = "";
$criteria->addSelectColumn(TaskPeer::TAS_START); $row["USR_USERNAME"] = "";
$criteria->addSelectColumn(TaskPeer::TAS_TYPE); $row["USR_FIRSTNAME"] = "";
$criteria->addSelectColumn(TaskPeer::TAS_DERIVATION); $row["USR_LASTNAME"] = "";
$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();
//Task //Task
if ($row["TAS_TYPE"] == "NORMAL") { if ($row["TAS_TYPE"] == "NORMAL") {
@@ -2189,17 +2181,9 @@ class Cases
$row["TAS_TITLE"] = $task->getTasTitle(); $row["TAS_TITLE"] = $task->getTasTitle();
} }
} else { } else {
$criteria2 = new Criteria("workflow");
$criteria2->addSelectColumn(SubProcessPeer::PRO_UID); //Get the task information when the task type is different from normal
$criteria2->addSelectColumn(TaskPeer::TAS_TITLE); $rsCriteria2 = $case->getTaskInfoForSubProcess($processUid, $row["TAS_UID"]);
$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);
$rsCriteria2->next(); $rsCriteria2->next();
@@ -2215,18 +2199,8 @@ class Cases
$routeType = ""; $routeType = "";
$arrayRoute = array(); $arrayRoute = array();
$criteria2 = new Criteria("workflow"); //Get the routes of a task
$rsCriteria2 = $case->getTaskRoutes($processUid, $row["TAS_UID"]);
$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);
while ($rsCriteria2->next()) { while ($rsCriteria2->next()) {
$row2 = $rsCriteria2->getRow(); $row2 = $rsCriteria2->getRow();
@@ -2243,25 +2217,7 @@ class Cases
//Delegations //Delegations
$arrayAppDelegation = array(); $arrayAppDelegation = array();
$criteria2 = new Criteria("workflow"); $rsCriteria2 = $case->getCaseDelegations($applicationUid, $row["TAS_UID"]);
$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);
while ($rsCriteria2->next()) { while ($rsCriteria2->next()) {
$row2 = $rsCriteria2->getRow(); $row2 = $rsCriteria2->getRow();
@@ -2292,8 +2248,10 @@ class Cases
$appDelegationDuration = G::LoadTranslation("ID_NOT_FINISHED"); $appDelegationDuration = G::LoadTranslation("ID_NOT_FINISHED");
if (!empty($row2["DEL_FINISH_DATE"]) && !empty($row2["DEL_INIT_DATE"])) { $date = empty($row2["DEL_INIT_DATE"]) ? $row2["DEL_DELEGATE_DATE"] : $row2["DEL_INIT_DATE"];
$t = strtotime($row2["DEL_FINISH_DATE"]) - strtotime($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); $h = $t * (1 / 60) * (1 / 60);
$m = ($h - (int)($h)) * (60 / 1); $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_FINISH_DATE") => $arrayAppDelegationDate["DEL_FINISH_DATE"]["dateFormated"],
$this->getFieldNameByFormatFieldName("DEL_DURATION") => $appDelegationDuration, $this->getFieldNameByFormatFieldName("DEL_DURATION") => $appDelegationDuration,
$this->getFieldNameByFormatFieldName("USR_UID") => $row2["USR_UID"], $this->getFieldNameByFormatFieldName("USR_UID") => $row2["USR_UID"],
$this->getFieldNameByFormatFieldName("USR_USERNAME") => $row2["USR_USERNAME"] . "", $this->getFieldNameByFormatFieldName("USR_USERNAME") => $row2["USR_USERNAME"],
$this->getFieldNameByFormatFieldName("USR_FIRSTNAME") => $row2["USR_FIRSTNAME"] . "", $this->getFieldNameByFormatFieldName("USR_FIRSTNAME") => $row2["USR_FIRSTNAME"],
$this->getFieldNameByFormatFieldName("USR_LASTNAME") => $row2["USR_LASTNAME"] . "" $this->getFieldNameByFormatFieldName("USR_LASTNAME") => $row2["USR_LASTNAME"]
); );
} }
//Status //Status
$status = ""; $status = "";
//$criteria2 $rsCriteria2 = $case->getTotalAndMinDateForACase($applicationUid, $row["TAS_UID"]);
$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->next(); $rsCriteria2->next();
$row2 = $rsCriteria2->getRow(); $row2 = $rsCriteria2->getRow();
//$criteria3 $rsCriteria3 = $case->getDelegationFinishDate($applicationUid, $row["TAS_UID"]);
$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->next(); $rsCriteria3->next();

View File

@@ -1,7 +1,10 @@
<?php <?php
namespace ProcessMaker\BusinessModel; namespace ProcessMaker\BusinessModel;
use G;
use Exception;
use PmDynaform; use PmDynaform;
use ProcessMaker\Util\PhpShorthandByte;
class InputDocument class InputDocument
{ {
@@ -288,7 +291,10 @@ class InputDocument
* @param string $processUid Unique id of Process * @param string $processUid Unique id of Process
* @param array $arrayData Data * @param array $arrayData Data
* *
* return array Return data of the new InputDocument created * @return array Return data of the new InputDocument created
*
* @see \ProcessMaker\Services\Api\Project\InputDocument->doPostInputDocument()
* @link https://wiki.processmaker.com/3.0/Input_Documents#Creating_Input_Documents
*/ */
public function create($processUid, $arrayData) public function create($processUid, $arrayData)
{ {
@@ -310,6 +316,8 @@ class InputDocument
$flagDataDestinationPath = (isset($arrayData["INP_DOC_DESTINATION_PATH"]))? 1 : 0; $flagDataDestinationPath = (isset($arrayData["INP_DOC_DESTINATION_PATH"]))? 1 : 0;
$flagDataTags = (isset($arrayData["INP_DOC_TAGS"]))? 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 //Create
$inputDocument = new \InputDocument(); $inputDocument = new \InputDocument();
@@ -348,8 +356,11 @@ class InputDocument
* *
* @param string $inputDocumentUid Unique id of InputDocument * @param string $inputDocumentUid Unique id of InputDocument
* @param array $arrayData Data * @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) public function update($inputDocumentUid, $arrayData)
{ {
@@ -374,6 +385,8 @@ class InputDocument
if (isset($arrayData["INP_DOC_TITLE"])) { if (isset($arrayData["INP_DOC_TITLE"])) {
$this->throwExceptionIfExistsTitle($processUid, $arrayData["INP_DOC_TITLE"], $this->arrayFieldNameForException["inputDocumentTitle"], $inputDocumentUid); $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 //Update
$arrayData["INP_DOC_UID"] = $inputDocumentUid; $arrayData["INP_DOC_UID"] = $inputDocumentUid;
@@ -519,7 +532,7 @@ class InputDocument
* *
* @param string $inputDocumentUid Unique id of 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) public function getInputDocument($inputDocumentUid)
{ {
@@ -544,5 +557,71 @@ class InputDocument
throw $e; 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;
}
} }

View File

@@ -1490,6 +1490,7 @@ class Light
} }
$response['listLanguage'] = $languagesList; $response['listLanguage'] = $languagesList;
if (isset($params['fileLimit']) && $params['fileLimit']) { if (isset($params['fileLimit']) && $params['fileLimit']) {
//to do: ProcessMaker\BusinessModel\InputDocument->getMaxFileSize()
$postMaxSize = $this->return_bytes(ini_get('post_max_size')); $postMaxSize = $this->return_bytes(ini_get('post_max_size'));
$uploadMaxFileSize = $this->return_bytes(ini_get('upload_max_filesize')); $uploadMaxFileSize = $this->return_bytes(ini_get('upload_max_filesize'));
if ($postMaxSize < $uploadMaxFileSize) { if ($postMaxSize < $uploadMaxFileSize) {

View File

@@ -117,7 +117,7 @@ class ProcessMap
$tmpData[5] = ""; $tmpData[5] = "";
$tmpData[6] = $lanes['lan_name']; $tmpData[6] = $lanes['lan_name'];
$tmpData[7] = ""; $tmpData[7] = "";
$tmpData[8] = $lanes['lan_uid']; $tmpData[8] = array_key_exists('lan_uid', $lanes) ? $lanes['lan_uid']: "";
$tmpData[9] = ""; $tmpData[9] = "";
$tmpData[10] = $lanes['bou_container']; $tmpData[10] = $lanes['bou_container'];
@@ -719,7 +719,7 @@ class ProcessMap
if($element['bou_container'] != "bpmnDiagram"){ if($element['bou_container'] != "bpmnDiagram"){
$resRec = $this->getNewPoints($element['bou_element'],$element['bou_container']); $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]); $result = array($element['bou_x'] + $resRec[0],$element['bou_y'] + $resRec[1]);
} }
} }

View File

@@ -0,0 +1,82 @@
<?php
namespace ProcessMaker\Util;
class PhpShorthandByte
{
private $units;
private $terminal;
/**
* Constructor.
* Supported format php directives:
* [number]G
* [number]K
* [number]M
*/
function __construct()
{
$this->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;
}
}

View File

@@ -8,6 +8,7 @@ use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Cache;
use ProcessMaker\Core\System; use ProcessMaker\Core\System;
use ProcessMaker\Services\OAuth2\Server; use ProcessMaker\Services\OAuth2\Server;
use ProcessMaker\Util\PhpShorthandByte;
use Symfony\Component\HttpFoundation\File\File; use Symfony\Component\HttpFoundation\File\File;
class ValidationUploadedFiles class ValidationUploadedFiles
@@ -169,6 +170,8 @@ class ValidationUploadedFiles
* File upload validation. * File upload validation.
* *
* @return $this * @return $this
*
* @see workflow/public_html/sysGeneric.php
*/ */
public function runRulesToAllUploadedFiles() public function runRulesToAllUploadedFiles()
{ {
@@ -177,6 +180,12 @@ class ValidationUploadedFiles
return; return;
} }
$this->fails = []; $this->fails = [];
$validator = $this->runRulesForFileEmpty();
if ($validator->fails()) {
$this->fails[] = $validator;
}
foreach ($files as $file) { foreach ($files as $file) {
$data = (object) $file; $data = (object) $file;
if (!is_array($data->name) || !is_array($data->tmp_name)) { if (!is_array($data->name) || !is_array($data->tmp_name)) {
@@ -207,9 +216,70 @@ class ValidationUploadedFiles
} }
} }
} }
return $this; 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. * Get the first error and call the argument function.
* *

View File

@@ -562,7 +562,8 @@ Ext.onReady(function(){
return key === false ? result : null; 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; navPanel.items[navPanel.items.length] = navPanelBottom;
} }

View File

@@ -29,6 +29,7 @@
var SYS_LANG = "{$SYS_LANG}"; var SYS_LANG = "{$SYS_LANG}";
var SYS_SKIN = "{$SYS_SKIN}"; var SYS_SKIN = "{$SYS_SKIN}";
var HTTP_SERVER_HOSTNAME = "{$HTTP_SERVER_HOSTNAME}"; var HTTP_SERVER_HOSTNAME = "{$HTTP_SERVER_HOSTNAME}";
var maxFileSizeInformation = {$maxFileSizeInformation};
</script> </script>
<script type="text/javascript" src="/lib-dev/js/wz_jsgraphics.js"></script> <script type="text/javascript" src="/lib-dev/js/wz_jsgraphics.js"></script>
<script type="text/javascript" src="/lib-dev/js/jquery-1.10.2.min.js"></script> <script type="text/javascript" src="/lib-dev/js/jquery-1.10.2.min.js"></script>
@@ -86,6 +87,7 @@
var SYS_LANG = "{$SYS_LANG}"; var SYS_LANG = "{$SYS_LANG}";
var SYS_SKIN = "{$SYS_SKIN}"; var SYS_SKIN = "{$SYS_SKIN}";
var HTTP_SERVER_HOSTNAME = "{$HTTP_SERVER_HOSTNAME}"; var HTTP_SERVER_HOSTNAME = "{$HTTP_SERVER_HOSTNAME}";
var maxFileSizeInformation = {$maxFileSizeInformation};
</script> </script>
<script type="text/javascript" src="/lib/js/mafe-{$buildhash}.js"></script> <script type="text/javascript" src="/lib/js/mafe-{$buildhash}.js"></script>
{foreach from=$sourceJs item=pathFile} {foreach from=$sourceJs item=pathFile}

View File

@@ -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_httponly', 1);
ini_set('session.cookie_secure', 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; //Set Time Zone
//$e_all = $config['debug'] ? $e_all : $e_all & ~ E_NOTICE; /*----------------------------------********---------------------------------*/
//$e_all = E_ALL & ~ E_DEPRECATED & ~ E_STRICT & ~ E_NOTICE & ~E_WARNING; $_SESSION['__SYSTEM_UTC_TIME_ZONE__'] = (int)($config['system_utc_time_zone']) == 1;
/*----------------------------------********---------------------------------*/
// Do not change any of these settings directly, use env.ini instead // Do not change any of these settings directly, use env.ini instead
ini_set('display_errors', $config['display_errors']); 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('default_charset', "UTF-8");
ini_set('memory_limit', $config['memory_limit']); ini_set('memory_limit', $config['memory_limit']);
ini_set('soap.wsdl_cache_enabled', $config['wsdl_cache']); 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_LOG', $config['debug_sql']);
define('DEBUG_SQL', $config['debug']); define('DEBUG_SQL', $config['debug']);
@@ -321,9 +323,7 @@ define('DEBUG_TIME_LOG', $config['debug_time']);
define('DEBUG_CALENDAR_LOG', $config['debug_calendar']); define('DEBUG_CALENDAR_LOG', $config['debug_calendar']);
define('MEMCACHED_ENABLED', $config['memcached']); define('MEMCACHED_ENABLED', $config['memcached']);
define('MEMCACHED_SERVER', $config['memcached_server']); define('MEMCACHED_SERVER', $config['memcached_server']);
define('WS_IN_LOGIN', isset($config['WS_IN_LOGIN']) ? $config['WS_IN_LOGIN'] : 'serverconf'); define('WS_IN_LOGIN', isset($config['WS_IN_LOGIN']) ? $config['WS_IN_LOGIN'] : 'serverconf');
define('LOAD_HEADERS_IE', $config['load_headers_ie']); define('LOAD_HEADERS_IE', $config['load_headers_ie']);
define('LEAVE_CASE_WARNING', $config['leave_case_warning']); define('LEAVE_CASE_WARNING', $config['leave_case_warning']);
define('REDIRECT_TO_MOBILE', $config['redirect_to_mobile']); 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_MAX_FILES', $config['logs_max_files']);
define('LOGS_LOCATION', $config['logs_location']); define('LOGS_LOCATION', $config['logs_location']);
define('LOGGING_LEVEL', $config['logging_level']); 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. // 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']; $_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('default_charset', "UTF-8");
ini_set('memory_limit', $config['memory_limit']); ini_set('memory_limit', $config['memory_limit']);
ini_set('soap.wsdl_cache_enabled', $config['wsdl_cache']); 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 // Load Language Translation
Bootstrap::LoadTranslationObject(defined('SYS_LANG') ? SYS_LANG : "en"); Bootstrap::LoadTranslationObject(defined('SYS_LANG') ? SYS_LANG : "en");
@@ -707,16 +712,6 @@ Bootstrap::LoadTranslationPlugins(defined('SYS_LANG') ? SYS_LANG : "en", $attrib
// Initialization functions plugins // Initialization functions plugins
$oPluginRegistry->init(); $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); $_GET = \ProcessMaker\Util\DateTime::convertDataToUtc($_GET);
$_POST = \ProcessMaker\Util\DateTime::convertDataToUtc($_POST); $_POST = \ProcessMaker\Util\DateTime::convertDataToUtc($_POST);