From fe1edd9e7f77e6697891d739c74e22566a568d86 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Tue, 28 Mar 2017 11:00:23 -0400 Subject: [PATCH 01/12] HOR-2922 --- workflow/engine/classes/class.pmDynaform.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/workflow/engine/classes/class.pmDynaform.php b/workflow/engine/classes/class.pmDynaform.php index 7df0110d1..4a4b2a34d 100644 --- a/workflow/engine/classes/class.pmDynaform.php +++ b/workflow/engine/classes/class.pmDynaform.php @@ -926,8 +926,7 @@ class pmDynaform $where = ""; if (!empty($parsed["WHERE"])) { $where = "WHERE "; - $dt = ($parsed['WHERE'][0]['expr_type'] == 'expression') ? $parsed['WHERE'][0]['sub_tree'] : - $parsed["WHERE"]; + $dt = ($parsed['WHERE'][0]['expr_type'] == 'expression') ? $parsed['WHERE'][0]['sub_tree'] : $parsed["WHERE"]; $nw = count($dt); //reserved word: OFFSET if ($dt[$nw - 2]["base_expr"] === "OFFSET") { @@ -953,9 +952,11 @@ class pmDynaform $groupBy = "GROUP BY "; $dt = $parsed["GROUP"]; foreach ($dt as $key => $value) { - $groupBy .= $value["base_expr"] . ", "; + $search = explode(" ", $value["base_expr"]); + $groupBy .= $search[0] . ", "; } $groupBy = rtrim($groupBy, ", "); + $groupBy .= " " . $value["direction"]; } $groupBy = trim($groupBy); @@ -974,7 +975,8 @@ class pmDynaform $orderBy = "ORDER BY "; $dt = $parsed["ORDER"]; foreach ($dt as $key => $value) { - $orderBy .= $value["base_expr"] . ", "; + $search = explode(" ", $value["base_expr"]); + $orderBy .= $search[0] . ", "; } $orderBy = rtrim($orderBy, ", "); $orderBy .= " " . $value["direction"]; From 4e99cf728c2dea1d88e9676035f20b6c815e70b8 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Tue, 28 Mar 2017 12:25:07 -0400 Subject: [PATCH 02/12] HOR-2922 --- workflow/engine/classes/class.pmDynaform.php | 1 - 1 file changed, 1 deletion(-) diff --git a/workflow/engine/classes/class.pmDynaform.php b/workflow/engine/classes/class.pmDynaform.php index 4a4b2a34d..c53755b9b 100644 --- a/workflow/engine/classes/class.pmDynaform.php +++ b/workflow/engine/classes/class.pmDynaform.php @@ -956,7 +956,6 @@ class pmDynaform $groupBy .= $search[0] . ", "; } $groupBy = rtrim($groupBy, ", "); - $groupBy .= " " . $value["direction"]; } $groupBy = trim($groupBy); From 4241846aabdc12a464ddc127b35fe72214173f97 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Tue, 28 Mar 2017 13:26:02 -0400 Subject: [PATCH 03/12] HOR-2922 --- workflow/engine/classes/class.pmDynaform.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/workflow/engine/classes/class.pmDynaform.php b/workflow/engine/classes/class.pmDynaform.php index c53755b9b..80f814441 100644 --- a/workflow/engine/classes/class.pmDynaform.php +++ b/workflow/engine/classes/class.pmDynaform.php @@ -952,8 +952,8 @@ class pmDynaform $groupBy = "GROUP BY "; $dt = $parsed["GROUP"]; foreach ($dt as $key => $value) { - $search = explode(" ", $value["base_expr"]); - $groupBy .= $search[0] . ", "; + $search = preg_replace("/ ASC$/i", "", $value["base_expr"]); + $groupBy .= $search . ", "; } $groupBy = rtrim($groupBy, ", "); } @@ -974,8 +974,8 @@ class pmDynaform $orderBy = "ORDER BY "; $dt = $parsed["ORDER"]; foreach ($dt as $key => $value) { - $search = explode(" ", $value["base_expr"]); - $orderBy .= $search[0] . ", "; + $search = preg_replace("/ ASC$/i", "", $value["base_expr"]); + $orderBy .= $search . ", "; } $orderBy = rtrim($orderBy, ", "); $orderBy .= " " . $value["direction"]; From 54418b047000ea24fd90c81ceb688add174f92cc Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Tue, 28 Mar 2017 14:25:11 -0400 Subject: [PATCH 04/12] HOR-2922 --- workflow/engine/classes/class.pmDynaform.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/workflow/engine/classes/class.pmDynaform.php b/workflow/engine/classes/class.pmDynaform.php index 80f814441..e7660c524 100644 --- a/workflow/engine/classes/class.pmDynaform.php +++ b/workflow/engine/classes/class.pmDynaform.php @@ -975,10 +975,9 @@ class pmDynaform $dt = $parsed["ORDER"]; foreach ($dt as $key => $value) { $search = preg_replace("/ ASC$/i", "", $value["base_expr"]); - $orderBy .= $search . ", "; + $orderBy .= $search . " " . $value["direction"] . ", "; } $orderBy = rtrim($orderBy, ", "); - $orderBy .= " " . $value["direction"]; } $orderBy = trim($orderBy); From 6c6fe9283ead1e386029a7e509fd535718341fad Mon Sep 17 00:00:00 2001 From: dheeyi william Date: Wed, 29 Mar 2017 15:12:11 -0400 Subject: [PATCH 05/12] HOR-2924 Fatal Error when run "cron" the plugin Multitenant --- workflow/engine/classes/class.wsTools.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/workflow/engine/classes/class.wsTools.php b/workflow/engine/classes/class.wsTools.php index 29d8be18d..fa9bb02c1 100644 --- a/workflow/engine/classes/class.wsTools.php +++ b/workflow/engine/classes/class.wsTools.php @@ -5,7 +5,9 @@ * * @author Alexandre Rosenfeld */ - +G::LoadSystem('dbMaintenance'); +G::LoadClass("cli"); +G::LoadClass("multipleFilesBackup"); /** * class workspaceTools * From 02d97d86cc4c6dc5b04b6f2ef58c31c0293d445c Mon Sep 17 00:00:00 2001 From: dheeyi william Date: Thu, 30 Mar 2017 15:41:51 -0400 Subject: [PATCH 06/12] HOR-2923 Import/Export of a plugin does not work correctly --- .../ProcessMaker/BusinessModel/Migrator/GranularImporter.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/GranularImporter.php b/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/GranularImporter.php index 1d40a6835..dd467a979 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/GranularImporter.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/GranularImporter.php @@ -14,6 +14,7 @@ class GranularImporter protected $factory; protected $data; + protected $regeneratedUids; /** * GranularImporter constructor. */ @@ -140,7 +141,8 @@ class GranularImporter :$data['tables']['workflow']['process'][0]['PRO_UID']; $objectList[$nameObject] = []; $objectList[$nameObject]['metadata'] = [ - 'PRJ_UID' => $prjUID + 'PRJ_UID' => $prjUID, + 'REGENERATED_UIDS' => $this->regeneratedUids ]; foreach ($data['tables']['plugins'] as $pluginKey => $pluginTable) { $key = explode(".", $pluginKey); @@ -325,6 +327,7 @@ class GranularImporter $newData['tables']['workflow'] = $arrayWorkflowTables; $newData['tables']['plugins'] = isset($data["tables"]["plugins"]) ? $data["tables"]["plugins"] : []; $newData['files']['workflow'] = $arrayWorkflowFiles; + $this->regeneratedUids = $result; return array( 'data' => $newData, From 8305cee7ccb12b08ffbf557184190e142d1d3af5 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Thu, 30 Mar 2017 15:45:01 -0400 Subject: [PATCH 07/12] HOR-2917 --- workflow/engine/classes/class.patch.php | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/workflow/engine/classes/class.patch.php b/workflow/engine/classes/class.patch.php index 75b39fa10..efcd15065 100644 --- a/workflow/engine/classes/class.patch.php +++ b/workflow/engine/classes/class.patch.php @@ -26,19 +26,27 @@ class p11835 extends patch */ static public function isApplicable() { - if (! class_exists('System')) { + if (!class_exists('System')) { G::LoadClass("System"); } patch::$isPathchable = false; $con = Propel::getConnection("workflow"); - $stmt = $con->prepareStatement("describe TASK;"); + $stmt = $con->prepareStatement("SHOW TABLES LIKE 'TASK'"); $rs = $stmt->executeQuery(); $rs->next(); - while($row = $rs->getRow()) { + $row = $rs->getRow(); + if (empty($row) === true) { + return patch::$isPathchable; + } + + $stmt = $con->prepareStatement("DESCRIBE TASK"); + $rs = $stmt->executeQuery(); + $rs->next(); + while ($row = $rs->getRow()) { if ($row ['Field'] == "TAS_GROUP_VARIABLE") { - $version = System::getVersion (); - $version = explode('-',$version); + $version = System::getVersion(); + $version = explode('-', $version); if ($version[0] == '2.5.1') { echo "Version " . $version[0] . " Patch\n"; patch::$isPathchable = true; @@ -49,7 +57,7 @@ class p11835 extends patch } return patch::$isPathchable; } - + public static function pmVersion($version) { if (preg_match("/^\D*([\d\.]+)\D*$/", $version, $matches)) { From 5010993db4233a83f9121524ca2005d2504c4e9b Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Fri, 31 Mar 2017 14:20:23 -0400 Subject: [PATCH 08/12] HOR-2917 --- gulliver/system/class.dbMaintenance.php | 86 ++++++++++++++++++++----- workflow/engine/classes/class.patch.php | 18 ++---- 2 files changed, 76 insertions(+), 28 deletions(-) diff --git a/gulliver/system/class.dbMaintenance.php b/gulliver/system/class.dbMaintenance.php index 496fd6e1c..eb3f757de 100644 --- a/gulliver/system/class.dbMaintenance.php +++ b/gulliver/system/class.dbMaintenance.php @@ -399,32 +399,88 @@ class DataBaseMaintenance */ function backupDataBase ($outfile) { + $password = escapeshellarg($this->passwd); + + //On Windows, escapeshellarg() instead replaces percent signs, exclamation + //marks (delayed variable substitution) and double quotes with spaces and + //adds double quotes around the string. + //See: http://php.net/manual/en/function.escapeshellarg.php + if (PATH_SEP !== "/") { + $password = $this->escapeshellargCustom($this->passwd); + } $aHost = explode(':', $this->host); $dbHost = $aHost[0]; if (isset($aHost[1])) { $dbPort = $aHost[1]; $command = 'mysqldump' - . ' --user=' . $this->user - . ' --password=' . escapeshellarg($this->passwd) - . ' --host=' . $dbHost - . ' --port=' . $dbPort - . ' --opt' - . ' --skip-comments' - . ' ' . $this->dbName - . ' > ' . $outfile; + . ' --user=' . $this->user + . ' --password=' . $password + . ' --host=' . $dbHost + . ' --port=' . $dbPort + . ' --opt' + . ' --skip-comments' + . ' ' . $this->dbName + . ' > ' . $outfile; } else { $command = 'mysqldump' - . ' --host=' . $dbHost - . ' --user=' . $this->user - . ' --opt' - . ' --skip-comments' - . ' --password=' . escapeshellarg($this->passwd) - . ' ' . $this->dbName - . ' > ' . $outfile; + . ' --host=' . $dbHost + . ' --user=' . $this->user + . ' --opt' + . ' --skip-comments' + . ' --password=' . $password + . ' ' . $this->dbName + . ' > ' . $outfile; } shell_exec($command); } + /** + * string escapeshellargCustom ( string $arg , character $quotes) + * + * escapeshellarg() adds single quotes around a string and quotes/escapes any + * existing single quotes allowing you to pass a string directly to a shell + * function and having it be treated as a single safe argument. This function + * should be used to escape individual arguments to shell functions coming + * from user input. The shell functions include exec(), system() and the + * backtick operator. + * + * On Windows, escapeshellarg() instead replaces percent signs, exclamation + * marks (delayed variable substitution) and double quotes with spaces and + * adds double quotes around the string. + */ + private function escapeshellargCustom($string, $quotes = "") + { + if ($quotes === "") { + $quotes = PHP_OS == "WINNT" ? "\"" : "'"; + } + $n = strlen($string); + $especial = ["!", "%", "\""]; + $substring = ""; + $result1 = []; + $result2 = []; + for ($i = 0; $i < $n; $i++) { + if (in_array($string[$i], $especial, true)) { + $result2[] = $string[$i]; + $result1[] = $substring; + $substring = ""; + } else { + $substring = $substring . $string[$i]; + } + } + $result1[] = $substring; + //Rebuild the password string + $n = count($result1); + for ($i = 0; $i < $n; $i++) { + $result1[$i] = trim(escapeshellarg($result1[$i]), $quotes); + if (isset($result2[$i])) { + $result1[$i] = $result1[$i] . $result2[$i]; + } + } + //add simple quotes, see escapeshellarg function + $newString = $quotes . implode("", $result1) . $quotes; + return $newString; + } + /** * restoreFromSql * diff --git a/workflow/engine/classes/class.patch.php b/workflow/engine/classes/class.patch.php index efcd15065..f19d967e0 100644 --- a/workflow/engine/classes/class.patch.php +++ b/workflow/engine/classes/class.patch.php @@ -26,27 +26,19 @@ class p11835 extends patch */ static public function isApplicable() { - if (!class_exists('System')) { + if (! class_exists('System')) { G::LoadClass("System"); } patch::$isPathchable = false; $con = Propel::getConnection("workflow"); - $stmt = $con->prepareStatement("SHOW TABLES LIKE 'TASK'"); + $stmt = $con->prepareStatement("describe TASK;"); $rs = $stmt->executeQuery(); $rs->next(); - $row = $rs->getRow(); - if (empty($row) === true) { - return patch::$isPathchable; - } - - $stmt = $con->prepareStatement("DESCRIBE TASK"); - $rs = $stmt->executeQuery(); - $rs->next(); - while ($row = $rs->getRow()) { + while($row = $rs->getRow()) { if ($row ['Field'] == "TAS_GROUP_VARIABLE") { - $version = System::getVersion(); - $version = explode('-', $version); + $version = System::getVersion (); + $version = explode('-',$version); if ($version[0] == '2.5.1') { echo "Version " . $version[0] . " Patch\n"; patch::$isPathchable = true; From fc0edb47700b0860777fff57649f540498126530 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Fri, 31 Mar 2017 16:38:29 -0400 Subject: [PATCH 09/12] HOR-2917 --- gulliver/system/class.dbMaintenance.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/gulliver/system/class.dbMaintenance.php b/gulliver/system/class.dbMaintenance.php index eb3f757de..b9b1c8664 100644 --- a/gulliver/system/class.dbMaintenance.php +++ b/gulliver/system/class.dbMaintenance.php @@ -49,6 +49,7 @@ class DataBaseMaintenance protected $tmpDir; protected $outfile; protected $infile; + protected $isWindows; /** * __construct @@ -64,7 +65,7 @@ class DataBaseMaintenance $this->tmpDir = './'; $this->link = null; $this->dbName = null; - + $this->isWindows = strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'; if (isset( $host ) && isset( $user ) && isset( $passwd )) { $this->host = $host; $this->user = $user; @@ -405,7 +406,7 @@ class DataBaseMaintenance //marks (delayed variable substitution) and double quotes with spaces and //adds double quotes around the string. //See: http://php.net/manual/en/function.escapeshellarg.php - if (PATH_SEP !== "/") { + if ($this->isWindows) { $password = $this->escapeshellargCustom($this->passwd); } $aHost = explode(':', $this->host); @@ -451,15 +452,15 @@ class DataBaseMaintenance private function escapeshellargCustom($string, $quotes = "") { if ($quotes === "") { - $quotes = PHP_OS == "WINNT" ? "\"" : "'"; + $quotes = $this->isWindows ? "\"" : "'"; } $n = strlen($string); - $especial = ["!", "%", "\""]; + $special = ["!", "%", "\""]; $substring = ""; $result1 = []; $result2 = []; for ($i = 0; $i < $n; $i++) { - if (in_array($string[$i], $especial, true)) { + if (in_array($string[$i], $special, true)) { $result2[] = $string[$i]; $result1[] = $substring; $substring = ""; From 6bd68b3028f7ab1c24519c8b3c018c1c25900093 Mon Sep 17 00:00:00 2001 From: qronald Date: Thu, 6 Apr 2017 10:04:29 -0400 Subject: [PATCH 10/12] HOR-2988 --- workflow/engine/classes/model/AppDocument.php | 6 +++--- workflow/engine/classes/model/Application.php | 4 ++-- workflow/engine/classes/model/Department.php | 2 +- workflow/engine/classes/model/Dynaform.php | 4 ++-- workflow/engine/classes/model/Groupwf.php | 3 ++- workflow/engine/classes/model/InputDocument.php | 4 ++-- workflow/engine/classes/model/OutputDocument.php | 9 ++++----- workflow/engine/classes/model/Process.php | 4 ++-- workflow/engine/classes/model/ReportTable.php | 2 +- workflow/engine/classes/model/Task.php | 14 +++++++------- workflow/engine/classes/model/Triggers.php | 4 ++-- 11 files changed, 28 insertions(+), 28 deletions(-) diff --git a/workflow/engine/classes/model/AppDocument.php b/workflow/engine/classes/model/AppDocument.php index a3e326d75..7e9eb6075 100644 --- a/workflow/engine/classes/model/AppDocument.php +++ b/workflow/engine/classes/model/AppDocument.php @@ -369,7 +369,7 @@ class AppDocument extends BaseAppDocument if ($sValue !== null && ! is_string( $sValue )) { $sValue = (string) $sValue; } - if ($this->app_doc_title !== $sValue || $sValue === '') { + if (in_array(AppDocumentPeer::APP_DOC_TITLE, $this->modifiedColumns) || $sValue === '') { try { $this->app_doc_title = $sValue; $iResult = Content::addContent( 'APP_DOC_TITLE', $this->getDocVersion(), $this->getAppDocUid(), (defined( 'SYS_LANG' ) ? SYS_LANG : 'en'), $this->app_doc_title ); @@ -411,7 +411,7 @@ class AppDocument extends BaseAppDocument if ($sValue !== null && ! is_string( $sValue )) { $sValue = (string) $sValue; } - if ($this->app_doc_comment !== $sValue || $sValue === '') { + if (in_array(AppDocumentPeer::APP_DOC_COMMENT, $this->modifiedColumns) || $sValue === '') { try { $this->app_doc_comment = $sValue; $iResult = Content::addContent( 'APP_DOC_COMMENT', $this->getDocVersion(), $this->getAppDocUid(), (defined( 'SYS_LANG' ) ? SYS_LANG : 'en'), $this->app_doc_comment ); @@ -453,7 +453,7 @@ class AppDocument extends BaseAppDocument if ($sValue !== null && ! is_string( $sValue )) { $sValue = (string) $sValue; } - if ($this->app_doc_filename !== $sValue || $sValue === '') { + if (in_array(AppDocumentPeer::APP_DOC_FILENAME, $this->modifiedColumns) || $sValue === '') { try { $this->app_doc_filename = $sValue; $iResult = Content::addContent( 'APP_DOC_FILENAME', $this->getDocVersion(), $this->getAppDocUid(), (defined( 'SYS_LANG' ) ? SYS_LANG : 'en'), $this->app_doc_filename ); diff --git a/workflow/engine/classes/model/Application.php b/workflow/engine/classes/model/Application.php index 9fad21d8a..03397d64e 100644 --- a/workflow/engine/classes/model/Application.php +++ b/workflow/engine/classes/model/Application.php @@ -89,7 +89,7 @@ class Application extends BaseApplication $v = (string) $v; } - if ($this->app_title_content !== $v || $v === '') { + if (in_array(ApplicationPeer::APP_TITLE, $this->modifiedColumns) || $v === '') { $this->app_title_content = $v; $lang = defined('SYS_LANG')? SYS_LANG : 'en'; $res = Content::addContent('APP_TITLE', '', $this->getAppUid(), $lang, $this->app_title_content); @@ -130,7 +130,7 @@ class Application extends BaseApplication $v = (string) $v; } - if ($this->app_description_content !== $v || $v === '') { + if (in_array(ApplicationPeer::APP_DESCRIPTION, $this->modifiedColumns) || $v === '') { $this->app_description_content = $v; $lang = defined('SYS_LANG')? SYS_LANG : 'en'; $res = Content::addContent('APP_DESCRIPTION', '', $this->getAppUid(), $lang, $this->app_description_content); diff --git a/workflow/engine/classes/model/Department.php b/workflow/engine/classes/model/Department.php index 2661f00b4..7c11bde98 100644 --- a/workflow/engine/classes/model/Department.php +++ b/workflow/engine/classes/model/Department.php @@ -167,7 +167,7 @@ class Department extends BaseDepartment $v = (string) $v; } - if ($this->depo_title !== $v || $v === '') { + if (in_array(DepartmentPeer::DEP_TITLE, $this->modifiedColumns) || $v === '') { $this->depo_title = $v; $lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en'; $res = Content::addContent( 'DEPO_TITLE', '', $this->getDepUid(), $lang, $this->depo_title ); diff --git a/workflow/engine/classes/model/Dynaform.php b/workflow/engine/classes/model/Dynaform.php index d60f63763..cb2a782d3 100644 --- a/workflow/engine/classes/model/Dynaform.php +++ b/workflow/engine/classes/model/Dynaform.php @@ -82,7 +82,7 @@ class Dynaform extends BaseDynaform $v = (string) $v; } - if ($this->dyn_title_content !== $v || $v === '') { + if (in_array(DynaformPeer::DYN_TITLE, $this->modifiedColumns) || $v === '') { $this->dyn_title_content = $v; $lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en'; @@ -131,7 +131,7 @@ class Dynaform extends BaseDynaform $v = (string) $v; } - if ($this->dyn_description !== $v || $v === '') { + if (in_array(DynaformPeer::DYN_DESCRIPTION, $this->modifiedColumns) || $v === '') { $this->dyn_description = $v; $lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en'; diff --git a/workflow/engine/classes/model/Groupwf.php b/workflow/engine/classes/model/Groupwf.php index 888c176d8..44c7b0ab2 100644 --- a/workflow/engine/classes/model/Groupwf.php +++ b/workflow/engine/classes/model/Groupwf.php @@ -60,7 +60,8 @@ class Groupwf extends BaseGroupwf $v = (string) $v; } - if ($this->grp_title_content !== $v || $v === '') { + if (in_array(GroupwfPeer::GRP_TITLE, $this->modifiedColumns) !== $v || $v + === '') { $this->grp_title_content = $v; $lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en'; $res = Content::addContent( 'GRP_TITLE', '', $this->getGrpUid(), $lang, $this->grp_title_content ); diff --git a/workflow/engine/classes/model/InputDocument.php b/workflow/engine/classes/model/InputDocument.php index 1556a6ff7..e990e5308 100644 --- a/workflow/engine/classes/model/InputDocument.php +++ b/workflow/engine/classes/model/InputDocument.php @@ -316,7 +316,7 @@ class InputDocument extends BaseInputDocument if ($sValue !== null && ! is_string( $sValue )) { $sValue = (string) $sValue; } - if ($this->inp_doc_title_content !== $sValue || $sValue === '') { + if (in_array(InputDocumentPeer::INP_DOC_TITLE, $this->modifiedColumns) || $sValue === '') { try { $this->inp_doc_title_content = $sValue; @@ -356,7 +356,7 @@ class InputDocument extends BaseInputDocument if ($sValue !== null && ! is_string( $sValue )) { $sValue = (string) $sValue; } - if ($this->inp_doc_description_content !== $sValue || $sValue === '') { + if (in_array(InputDocumentPeer::INP_DOC_DESCRIPTION, $this->modifiedColumns) || $sValue === '') { try { $this->inp_doc_description_content = $sValue; diff --git a/workflow/engine/classes/model/OutputDocument.php b/workflow/engine/classes/model/OutputDocument.php index 40241b448..f11cab900 100644 --- a/workflow/engine/classes/model/OutputDocument.php +++ b/workflow/engine/classes/model/OutputDocument.php @@ -364,8 +364,7 @@ class OutputDocument extends BaseOutputDocument if ($sValue !== null && !is_string($sValue)) { $sValue = (string) $sValue; } - - if ($this->out_doc_title !== $sValue || $sValue === '') { + if (in_array(OutputDocumentPeer::OUT_DOC_TITLE, $this->modifiedColumns) || $sValue === '') { try { $this->out_doc_title = $sValue; @@ -411,7 +410,7 @@ class OutputDocument extends BaseOutputDocument $sValue = (string) $sValue; } - if ($this->out_doc_description !== $sValue || $sValue === '') { + if (in_array(OutputDocumentPeer::OUT_DOC_DESCRIPTION, $this->modifiedColumns) || $sValue === '') { try { $this->out_doc_description = $sValue; @@ -457,7 +456,7 @@ class OutputDocument extends BaseOutputDocument $sValue = (string) $sValue; } - if ($this->out_doc_filename !== $sValue || $sValue === '') { + if (in_array(OutputDocumentPeer::OUT_DOC_FILENAME, $this->modifiedColumns) || $sValue === '') { try { $this->out_doc_filename = $sValue; @@ -503,7 +502,7 @@ class OutputDocument extends BaseOutputDocument $sValue = (string) $sValue; } - if ($this->out_doc_template !== $sValue || $sValue === '') { + if (in_array(OutputDocumentPeer::OUT_DOC_TEMPLATE, $this->modifiedColumns) || $sValue === '') { try { $this->out_doc_template = $sValue; diff --git a/workflow/engine/classes/model/Process.php b/workflow/engine/classes/model/Process.php index 40911c226..f07d8e171 100644 --- a/workflow/engine/classes/model/Process.php +++ b/workflow/engine/classes/model/Process.php @@ -83,7 +83,7 @@ class Process extends BaseProcess $v = (string) $v; } - if ($this->pro_title_content !== $v || $v === '') { + if (in_array(ProcessPeer::PRO_TITLE, $this->modifiedColumns) || $v === '') { $this->pro_title_content = $v; $lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en'; @@ -132,7 +132,7 @@ class Process extends BaseProcess $v = (string) $v; } - if ($this->pro_description_content !== $v || $v === '') { + if (in_array(ProcessPeer::PRO_DESCRIPTION, $this->modifiedColumns) || $v === '') { $this->pro_description_content = $v; $lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en'; diff --git a/workflow/engine/classes/model/ReportTable.php b/workflow/engine/classes/model/ReportTable.php index 86c6ffcff..9645180f5 100644 --- a/workflow/engine/classes/model/ReportTable.php +++ b/workflow/engine/classes/model/ReportTable.php @@ -71,7 +71,7 @@ class ReportTable extends BaseReportTable } $v = isset( $v ) ? ((string) $v) : ''; $lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en'; - if ($this->rep_tab_title !== $v || $v === "") { + if (in_array(ReportTablePeer::REP_TAB_TITLE, $this->modifiedColumns) || $v === "") { $this->rep_tab_title = $v; $res = Content::addContent( 'REP_TAB_TITLE', '', $this->getRepTabUid(), $lang, $this->rep_tab_title ); return $res; diff --git a/workflow/engine/classes/model/Task.php b/workflow/engine/classes/model/Task.php index 890f1a86d..2e72dc8a7 100644 --- a/workflow/engine/classes/model/Task.php +++ b/workflow/engine/classes/model/Task.php @@ -53,7 +53,7 @@ class Task extends BaseTask $v = isset($v)? ((string)$v) : ''; $lang = defined('SYS_LANG')? SYS_LANG : 'en'; - if ($this->tas_title_content !== $v || $v === "") { + if (in_array(TaskPeer::TAS_TITLE, $this->modifiedColumns) || $v === "") { $this->tas_title_content = $v; $res = Content::addContent('TAS_TITLE', '', $this->getTasUid(), $lang, $this->tas_title_content); @@ -101,7 +101,7 @@ class Task extends BaseTask $v = isset($v)? ((string)$v) : ''; $lang = defined('SYS_LANG')? SYS_LANG : 'en'; - if ($this->tas_description_content !== $v || $v === "") { + if (in_array(TaskPeer::TAS_DESCRIPTION, $this->modifiedColumns) || $v === "") { $this->tas_description_content = $v; $res = Content::addContent('TAS_DESCRIPTION', '', $this->getTasUid(), $lang, $this->tas_description_content); @@ -149,7 +149,7 @@ class Task extends BaseTask $v = isset($v)? ((string)$v) : ''; $lang = defined('SYS_LANG')? SYS_LANG : 'en'; - if ($this->tas_def_title_content !== $v || $v === "") { + if (in_array(TaskPeer::TAS_DEF_TITLE, $this->modifiedColumns) || $v === "") { $this->tas_def_title_content = $v; $res = Content::addContent('TAS_DEF_TITLE', '', $this->getTasUid(), $lang, $this->tas_def_title_content); @@ -197,7 +197,7 @@ class Task extends BaseTask $v = isset($v)? ((string)$v) : ''; $lang = defined('SYS_LANG')? SYS_LANG : 'en'; - if ($this->tas_def_description_content !== $v || $v === "") { + if (in_array(TaskPeer::TAS_DEF_DESCRIPTION, $this->modifiedColumns) || $v === "") { $this->tas_def_description_content = $v; $res = Content::addContent('TAS_DEF_DESCRIPTION', '', $this->getTasUid(), $lang, $v); @@ -244,7 +244,7 @@ class Task extends BaseTask $v = isset($v)? ((string)$v) : ''; $lang = defined('SYS_LANG')? SYS_LANG : 'en'; - if ($this->tas_def_proc_code_content !== $v || $v === "") { + if (in_array(TaskPeer::TAS_DEF_PROC_CODE, $this->modifiedColumns) || $v === "") { $this->tas_def_proc_code_content = $v; $res = Content::addContent('TAS_DEF_PROC_CODE', '', $this->getTasUid(), $lang, $this->tas_def_proc_code_content); @@ -291,7 +291,7 @@ class Task extends BaseTask $v = isset($v)? ((string)$v) : ''; $lang = defined('SYS_LANG')? SYS_LANG : 'en'; - if ($this->tas_def_message_content !== $v || $v === "") { + if (in_array(TaskPeer::TAS_DEF_MESSAGE, $this->modifiedColumns) || $v === "") { $this->tas_def_message_content = $v; $res = Content::addContent('TAS_DEF_MESSAGE', '', $this->getTasUid(), $lang, $this->tas_def_message_content); @@ -339,7 +339,7 @@ class Task extends BaseTask $v = isset($v)? ((string)$v) : ''; $lang = defined('SYS_LANG')? SYS_LANG : 'en'; - if ($this->tas_def_subject_message_content !== $v || $v === "") { + if (in_array(TaskPeer::TAS_DEF_SUBJECT_MESSAGE, $this->modifiedColumns) || $v === "") { $this->tas_def_subject_message_content = $v; $res = Content::addContent('TAS_DEF_SUBJECT_MESSAGE', '', $this->getTasUid(), $lang, $v); diff --git a/workflow/engine/classes/model/Triggers.php b/workflow/engine/classes/model/Triggers.php index 0c7e3619b..b42ee7514 100644 --- a/workflow/engine/classes/model/Triggers.php +++ b/workflow/engine/classes/model/Triggers.php @@ -76,7 +76,7 @@ class Triggers extends BaseTriggers } $v=isset($v)?((string)$v):''; $lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en'; - if ($this->tri_title_content !== $v || $v==="") { + if (in_array(TriggersPeer::TRI_TITLE, $this->modifiedColumns) || $v==="") { $this->tri_title_content = $v; $res = Content::addContent( 'TRI_TITLE', '', $this->getTriUid(), $lang, $this->tri_title_content ); return $res; @@ -112,7 +112,7 @@ class Triggers extends BaseTriggers } $v=isset($v)?((string)$v):''; $lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en'; - if ($this->tri_description !== $v || $v==="") { + if (in_array(TriggersPeer::TRI_DESCRIPTION, $this->modifiedColumns) || $v==="") { $this->tri_description = $v; $res = Content::addContent( 'TRI_DESCRIPTION', '', $this->getTriUid(), $lang, $this->tri_description ); return $res; From 4d7eb42e8155f24924dd0b54ccb27b8e3077bdae Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Thu, 6 Apr 2017 10:50:56 -0400 Subject: [PATCH 11/12] HOR-2983 --- workflow/engine/classes/class.pmDynaform.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow/engine/classes/class.pmDynaform.php b/workflow/engine/classes/class.pmDynaform.php index 7df0110d1..6c98d3f34 100644 --- a/workflow/engine/classes/class.pmDynaform.php +++ b/workflow/engine/classes/class.pmDynaform.php @@ -681,7 +681,7 @@ class pmDynaform $this->fields["APP_DATA"] = $dataGridEnvironment; $dataGridEnvironment = []; } - if (isset($this->fields["APP_DATA"][$json->name])) { + if (isset($this->fields["APP_DATA"][$json->name]) && is_array($this->fields["APP_DATA"][$json->name])) { //rows $rows = $this->fields["APP_DATA"][$json->name]; foreach ($rows as $keyRow => $row) { From 4fb11e2faf0fe704e441bba2d10ed65147da6761 Mon Sep 17 00:00:00 2001 From: qronald Date: Fri, 7 Apr 2017 16:28:20 -0400 Subject: [PATCH 12/12] reopen --- workflow/engine/classes/model/Application.php | 5 +---- workflow/engine/classes/model/Dynaform.php | 2 +- workflow/engine/classes/model/Groupwf.php | 4 +--- workflow/engine/classes/model/Process.php | 5 +++-- workflow/engine/classes/model/Triggers.php | 2 +- 5 files changed, 7 insertions(+), 11 deletions(-) diff --git a/workflow/engine/classes/model/Application.php b/workflow/engine/classes/model/Application.php index 03397d64e..1159ea10e 100644 --- a/workflow/engine/classes/model/Application.php +++ b/workflow/engine/classes/model/Application.php @@ -252,14 +252,11 @@ class Application extends BaseApplication if ($this->validate()) { $con->begin(); - $res = $this->save(); - $con->commit(); - $this->setAppTitleContent('#' . $maxNumber); $this->setAppDescriptionContent(''); //to do: ID_CASE in translation $this->setAppTitle(G::LoadTranslation('ID_CASE') . $maxNumber); //Content::insertContent('APP_PROC_CODE', '', $this->getAppUid(), $lang, ''); - + $res = $this->save(); $con->commit(); return $this->getAppUid(); diff --git a/workflow/engine/classes/model/Dynaform.php b/workflow/engine/classes/model/Dynaform.php index cb2a782d3..b5d0e8927 100644 --- a/workflow/engine/classes/model/Dynaform.php +++ b/workflow/engine/classes/model/Dynaform.php @@ -209,9 +209,9 @@ class Dynaform extends BaseDynaform $this->setDynVersion( $aData['DYN_VERSION'] ); if ($this->validate()) { $con->begin(); - $res = $this->save(); $this->setDynTitleContent( $dynTitle ); $this->setDynDescriptionContent( $dynDescription ); + $res = $this->save(); $con->commit(); //Add Audit Log diff --git a/workflow/engine/classes/model/Groupwf.php b/workflow/engine/classes/model/Groupwf.php index 44c7b0ab2..dd2d826e1 100644 --- a/workflow/engine/classes/model/Groupwf.php +++ b/workflow/engine/classes/model/Groupwf.php @@ -106,14 +106,12 @@ class Groupwf extends BaseGroupwf if ($this->validate()) { $con->begin(); - $res = $this->save(); - if (isset( $aData['GRP_TITLE'] )) { $this->setGrpTitleContent( $aData['GRP_TITLE'] ); } else { $this->setGrpTitleContent( 'Default Group Title' ); } - + $res = $this->save(); $con->commit(); return $this->getGrpUid(); } else { diff --git a/workflow/engine/classes/model/Process.php b/workflow/engine/classes/model/Process.php index f07d8e171..e0d0f9ee0 100644 --- a/workflow/engine/classes/model/Process.php +++ b/workflow/engine/classes/model/Process.php @@ -198,7 +198,6 @@ class Process extends BaseProcess if ($this->validate()) { $con->begin(); - $res = $this->save(); if (isset( $aData['PRO_TITLE'] )) { $this->setProTitleContent( $aData['PRO_TITLE'] ); @@ -212,6 +211,7 @@ class Process extends BaseProcess $this->setProDescriptionContent( 'Default Process Description' ); } + $res = $this->save(); $con->commit(); $this->memcachedDelete(); @@ -445,7 +445,6 @@ class Process extends BaseProcess $this->setProDynaforms( isset( $aData['PRO_DYNAFORMS'] ) ? (is_array( $aData['PRO_DYNAFORMS'] ) ? serialize( $aData['PRO_DYNAFORMS'] ) : $aData['PRO_DYNAFORMS']) : '' ); if ($this->validate()) { $con->begin(); - $res = $this->save(); if (isset( $aData['PRO_TITLE'] ) && trim( $aData['PRO_TITLE'] ) != '') { $this->setProTitleContent( $aData['PRO_TITLE'] ); @@ -457,6 +456,8 @@ class Process extends BaseProcess } else { $this->setProDescriptionContent( 'Default Process Description' ); } + + $res = $this->save(); $con->commit(); $this->memcachedDelete(); diff --git a/workflow/engine/classes/model/Triggers.php b/workflow/engine/classes/model/Triggers.php index b42ee7514..b7eeb7bf6 100644 --- a/workflow/engine/classes/model/Triggers.php +++ b/workflow/engine/classes/model/Triggers.php @@ -169,9 +169,9 @@ class Triggers extends BaseTriggers } else { $this->setTriParam( $aData['TRI_PARAM'] ); } - $result=$this->save(); $this->setTriTitleContent($triTitle); $this->setTriDescriptionContent($triDescription); + $result = $this->save(); $con->commit(); //Add Audit Log $description = "Trigger Name: ".$aData['TRI_TITLE'].", Trigger Uid: ".$triggerUid;