From 18b00ee10a3ea05530317564e13a334f861ed6d9 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Mon, 21 Jan 2019 16:22:40 -0400 Subject: [PATCH 1/3] PMC-337-A --- thirdparty/creole/drivers/mssql/MSSQLConnection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thirdparty/creole/drivers/mssql/MSSQLConnection.php b/thirdparty/creole/drivers/mssql/MSSQLConnection.php index 27a08c1fc..cfcf30722 100644 --- a/thirdparty/creole/drivers/mssql/MSSQLConnection.php +++ b/thirdparty/creole/drivers/mssql/MSSQLConnection.php @@ -218,7 +218,7 @@ class MSSQLConnection extends ConnectionCommon implements Connection if (!$result) { throw new SQLException('Could not execute update', print_r(sqlsrv_errors(), true), $sql); } - return (int) sqlsrv_rows_affected($this->dblink); + return (int) sqlsrv_rows_affected($result); } else { if (!mssql_select_db($this->database, $this->dblink)) { throw new SQLException('No database selected'); From 71b76fce617b33d81f3cddf23d383f6308a6db39 Mon Sep 17 00:00:00 2001 From: Paula Quispe Date: Wed, 23 Jan 2019 08:10:28 -0400 Subject: [PATCH 2/3] PMC-400 --- workflow/engine/classes/Cases.php | 32 +++++++++++-------- .../engine/src/ProcessMaker/Util/helpers.php | 31 ++++++++++++++++++ 2 files changed, 49 insertions(+), 14 deletions(-) diff --git a/workflow/engine/classes/Cases.php b/workflow/engine/classes/Cases.php index 1b06cdc58..fa26b3871 100644 --- a/workflow/engine/classes/Cases.php +++ b/workflow/engine/classes/Cases.php @@ -3536,25 +3536,29 @@ class Cases $executedOn = $oPMScript->getExecutionOriginForAStep($stepType, $stepUidObj, $triggerType); $oPMScript->setExecutedOn($executedOn); $oPMScript->execute(); - $varsChanged = $oPMScript->getVarsChanged(); $appDataAfterTrigger = $oPMScript->aFields; - //Get the key and values changed only if the variable has the prefix - //@see https://wiki.processmaker.com/3.2/Triggers#Typing_rules_for_Case_Variables - $fieldsTrigger = $this->findKeysAndValues($appDataAfterTrigger, $varsChanged); + /** + * This section of code its related to the route the case with parallel task in the same time + * @link https://processmaker.atlassian.net/browse/PMC-2 + */ + if ($oPMScript->executedOn() === $oPMScript::AFTER_ROUTING) { + //Get the variables changed with the trigger + $fieldsTrigger = arrayDiffRecursive($appDataAfterTrigger, $fieldsCase); - - //We will be load the last appData because: - //Other execution can be changed the variables or Plugin or PMFunction - $appUid = !empty($fieldsCase['APPLICATION']) ? $fieldsCase['APPLICATION'] : ''; - if (!empty($appUid)) { - //Update $fieldsCase with the last appData - $fieldsCase = $this->loadCase($appUid)['APP_DATA']; + //We will be load the last appData because: + //Other thread execution can be changed the variables + $appUid = !empty($fieldsCase['APPLICATION']) ? $fieldsCase['APPLICATION'] : ''; + if (!empty($appUid)) { + //Update $fieldsCase with the last appData + $fieldsCase = $this->loadCase($appUid)['APP_DATA']; + } + //Merge the appData with variables changed + $fieldsCase = array_merge($fieldsCase, $fieldsTrigger); + } else { + $fieldsCase = $appDataAfterTrigger; } - //Merge the current appData with variables changed - $fieldsCase = array_merge($fieldsCase, $fieldsTrigger); - //Register the time execution $this->arrayTriggerExecutionTime[$trigger['TRI_UID']] = $oPMScript->scriptExecutionTime; //Register the message of execution diff --git a/workflow/engine/src/ProcessMaker/Util/helpers.php b/workflow/engine/src/ProcessMaker/Util/helpers.php index 9a44ab50b..8c96d7e53 100644 --- a/workflow/engine/src/ProcessMaker/Util/helpers.php +++ b/workflow/engine/src/ProcessMaker/Util/helpers.php @@ -400,6 +400,37 @@ function verifyCsrfToken($request) } } +/** + * Get the difference between to multidimensional array + * + * @param array $array1 + * @param array $array2 + * + * @return array +*/ +function arrayDiffRecursive(array $array1, array $array2) +{ + $difference = []; + foreach ($array1 as $key => $value) { + if (is_array($value)) { + if (!isset($array2[$key])) { + $difference[$key] = $value; + } elseif (!is_array($array2[$key])) { + $difference[$key] = $value; + } else { + $new_diff = arrayDiffRecursive($value, $array2[$key]); + if (!empty($new_diff)) { + $difference[$key] = $new_diff; + } + } + } elseif (!isset($array2[$key]) || $array2[$key] != $value) { + $difference[$key] = $value; + } + } + + return $difference; +} + /** * Get the current user CSRF token. * From ca7ac24b98a7504d8272fd83b6e14e28538596d3 Mon Sep 17 00:00:00 2001 From: Fabio Guachalla Date: Thu, 24 Jan 2019 07:53:52 -0400 Subject: [PATCH 3/3] PMC-44 --- gulliver/system/class.bootstrap.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gulliver/system/class.bootstrap.php b/gulliver/system/class.bootstrap.php index 7dfcb6f04..058c4c835 100644 --- a/gulliver/system/class.bootstrap.php +++ b/gulliver/system/class.bootstrap.php @@ -2644,8 +2644,8 @@ class Bootstrap { $isIE = false; if (isset($_SERVER['HTTP_USER_AGENT'])) { - $ua = htmlentities($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, 'UTF-8'); - if (preg_match('/MSIE|Internet Explorer|Trident\d+rv:11.0/i', $ua) || (strpos($ua, 'Trident/7.0; Touch; rv:11.0') !== false)) { + $userAgent = htmlentities($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, 'UTF-8'); + if (preg_match("/(Trident\/(\d{2,}|7|8|9)(.*)rv:(\d{2,}))|(MSIE\ (\d{2,}|8|9)(.*)Tablet\ PC)|(Trident\/(\d{2,}|7|8|9))/", $userAgent)) { $isIE = true; } }