From 88d151d9f126ebea83f974071047e49f85a4bd25 Mon Sep 17 00:00:00 2001 From: qronald Date: Wed, 24 May 2017 11:09:58 -0400 Subject: [PATCH 01/85] move of method to system --- workflow/engine/bin/tasks/cliCommon.php | 12 +-- .../engine/src/ProcessMaker/Util/System.php | 83 ++++++++++++++++++- 2 files changed, 85 insertions(+), 10 deletions(-) diff --git a/workflow/engine/bin/tasks/cliCommon.php b/workflow/engine/bin/tasks/cliCommon.php index 2e5653d2e..612c9d149 100644 --- a/workflow/engine/bin/tasks/cliCommon.php +++ b/workflow/engine/bin/tasks/cliCommon.php @@ -41,15 +41,9 @@ if(sizeof($output) == 3 && isset($output[2]) && isset($output[2][0])) { * returns all available workspaces * @return array of workspace objects */ -function get_workspaces_from_args($args, $includeAll = true) { - $workspaces = array(); - foreach ($args as $arg) { - $workspaces[] = new workspaceTools($arg); - } - if (empty($workspaces) && $includeAll) { - $workspaces = System::listWorkspaces(); - } - return $workspaces; +function get_workspaces_from_args($args, $includeAll = true) +{ + return \ProcessMaker\Util\System::getWorkspacesFromArgs($args, $includeAll); } ?> diff --git a/workflow/engine/src/ProcessMaker/Util/System.php b/workflow/engine/src/ProcessMaker/Util/System.php index 25ba3c2aa..0f830c233 100644 --- a/workflow/engine/src/ProcessMaker/Util/System.php +++ b/workflow/engine/src/ProcessMaker/Util/System.php @@ -7,6 +7,7 @@ class System * Get Time Zone * * @return string Return Time Zone + * @throws \Exception */ public static function getTimeZone() { @@ -19,5 +20,85 @@ class System throw $e; } } -} + public static function getWorkspacesFromArgs($args, $includeAll = true) + { + $workspaces = array(); + foreach ($args as $arg) { + $workspaces[] = new \workspaceTools($arg); + } + if (empty($workspaces) && $includeAll) { + $workspaces = \System::listWorkspaces(); + } + return $workspaces; + } + + /** + * Flush the cache files for the specified workspace(s). + * If no workspace is specified, then the cache will be flushed in all available + * workspaces. + * + * @param array $args + * @param type $opts + */ + public static function flushCache($args, $opts = null) + { + $rootDir = realpath(PATH_HOME . "/../"); + $app = new \Maveriks\WebApplication(); + $app->setRootDir($rootDir); + $loadConstants = false; + $workspaces = self::getWorkspacesFromArgs($args); + + if (!defined("PATH_C")) { + die("ERROR: seems processmaker is not properly installed (System constants are missing)." . PHP_EOL); + } + + //Update singleton file by workspace + foreach ($workspaces as $workspace) { + eprint("Update singleton in workspace " . $workspace->name . " ... "); + \Bootstrap::setConstantsRelatedWs($workspace->name); + $pathSingleton = PATH_DATA . "sites" . PATH_SEP . $workspace->name . PATH_SEP . "plugin.singleton"; + $oPluginRegistry = \PMPluginRegistry::loadSingleton($pathSingleton); + $items = \PMPlugin::getListAllPlugins($workspace->name); + foreach ($items as $item) { + if ($item->enabled === true) { + require_once($item->sFilename); + $details = $oPluginRegistry->getPluginDetails(basename($item->sFilename)); + //Only if the API directory structure is defined + $pathApiDirectory = PATH_PLUGINS . $details->sPluginFolder . PATH_SEP . "src" . PATH_SEP . "Services" . PATH_SEP . "Api"; + if (is_dir($pathApiDirectory)) { + $pluginSrcDir = PATH_PLUGINS . $details->sNamespace . PATH_SEP . 'src'; + $loader = \Maveriks\Util\ClassLoader::getInstance(); + $loader->add($pluginSrcDir); + $oPluginRegistry->registerRestService($details->sNamespace); + if (class_exists($details->sClassName)) { + $oPlugin = new $details->sClassName($details->sNamespace, $details->sFilename); + $oPlugin->setup(); + file_put_contents($pathSingleton, $oPluginRegistry->serializeInstance()); + } + } + } + } + eprintln("DONE"); + } + + //flush the cache files + \CLI::logging("Flush " . \pakeColor::colorize("system", "INFO") . " cache ... "); + \G::rm_dir(PATH_C); + \G::mk_dir(PATH_C, 0777); + echo "DONE" . PHP_EOL; + + foreach ($workspaces as $workspace) { + echo "Flush workspace " . \pakeColor::colorize($workspace->name, "INFO") . " cache ... "; + + \G::rm_dir($workspace->path . "/cache"); + \G::mk_dir($workspace->path . "/cache", 0777); + \G::rm_dir($workspace->path . "/cachefiles"); + \G::mk_dir($workspace->path . "/cachefiles", 0777); + if (file_exists($workspace->path . '/routes.php')) { + unlink($workspace->path . '/routes.php'); + } + echo "DONE" . PHP_EOL; + } + } +} From d384fad75414dbfce7660c43477165c3e6866ba2 Mon Sep 17 00:00:00 2001 From: qronald Date: Mon, 29 May 2017 08:47:29 -0400 Subject: [PATCH 02/85] add comment --- workflow/engine/src/ProcessMaker/Util/System.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/workflow/engine/src/ProcessMaker/Util/System.php b/workflow/engine/src/ProcessMaker/Util/System.php index 5d68c3708..c471e0ad4 100644 --- a/workflow/engine/src/ProcessMaker/Util/System.php +++ b/workflow/engine/src/ProcessMaker/Util/System.php @@ -28,6 +28,14 @@ class System } } + /** + * Returns workspace objects from an array of workspace names. + * + * @param array $args an array of workspace names + * @param bool $includeAll if true and no workspace is specified in args, + * returns all available workspaces + * @return array of workspace objects + */ public static function getWorkspacesFromArgs($args, $includeAll = true) { $workspaces = array(); From cadbe989b74e2501084f5fe762c31339cf7dffbf Mon Sep 17 00:00:00 2001 From: Dante Date: Mon, 12 Jun 2017 16:11:19 -0400 Subject: [PATCH 03/85] HOR-3095 --- workflow/engine/classes/class.calendar.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow/engine/classes/class.calendar.php b/workflow/engine/classes/class.calendar.php index defe5bb5c..98e2960b1 100644 --- a/workflow/engine/classes/class.calendar.php +++ b/workflow/engine/classes/class.calendar.php @@ -829,7 +829,7 @@ class calendar extends CalendarDefinition $newDate = $onlyDate; $hoursDuration -= (float)($secondRes/3600); } else { - $newDate = date('Y-m-d H:i:s', strtotime('+' . (((float)$hoursDuration)*3600) . ' seconds', strtotime($newDate))); + $newDate = date('Y-m-d H:i:s', strtotime('+' . round((((float)$hoursDuration)*3600), 5) . ' seconds', strtotime($newDate))); $hoursDuration = 0; } } From 1c0af47303040dc7bfb322af985e1e4d1002376a Mon Sep 17 00:00:00 2001 From: Rodrigo Quelca Date: Thu, 10 Aug 2017 10:13:30 -0400 Subject: [PATCH 04/85] FBI-2044: Need static id for "New" user button --- workflow/engine/templates/users/usersList.js | 76 ++++++++++---------- 1 file changed, 37 insertions(+), 39 deletions(-) diff --git a/workflow/engine/templates/users/usersList.js b/workflow/engine/templates/users/usersList.js index 6ec0e316d..47ff73075 100644 --- a/workflow/engine/templates/users/usersList.js +++ b/workflow/engine/templates/users/usersList.js @@ -1,7 +1,5 @@ -/* - * @author: Qennix - * Jan 24th, 2011 - */ + + //Keyboard Events new Ext.KeyMap(document, [ @@ -65,59 +63,59 @@ Ext.onReady(function(){ pageSize = parseInt(CONFIG.pageSize); newButton = new Ext.Action({ - text: _('ID_NEW'), - iconCls: 'button_menu_ext ss_sprite ss_add', - handler: NewUserAction + text: _('ID_NEW'), + iconCls: 'button_menu_ext ss_sprite ss_add', + id: 'usersBtnNew', + handler: NewUserAction }); summaryButton = new Ext.Action({ - text: _('ID_SUMMARY'), - iconCls: 'button_menu_ext ss_sprite ss_table', - handler: SummaryTabOpen, - disabled: true + text: _('ID_SUMMARY'), + id: 'usersBtnSummary', + iconCls: 'button_menu_ext ss_sprite ss_table', + handler: SummaryTabOpen, + disabled: true }); editButton = new Ext.Action({ - text: _('ID_EDIT'), - iconCls: 'button_menu_ext ss_sprite ss_pencil', - handler: EditUserAction, - disabled: true + text: _('ID_EDIT'), + id: 'usersBtnEdit', + iconCls: 'button_menu_ext ss_sprite ss_pencil', + handler: EditUserAction, + disabled: true }); changeStatusButton = new Ext.Button({ - text: _('ID_STATUS'), - icon: '', - iconCls: 'silk-add', - handler: changeStatusCheck, - disabled: true + text: _('ID_STATUS'), + id: 'usersBtnStatus', + icon: '', + iconCls: 'silk-add', + handler: changeStatusCheck, + disabled: true }); deleteButton = new Ext.Action({ - text: _('ID_DELETE'), - iconCls: 'button_menu_ext ss_sprite ss_delete', - handler: DeleteUserAction, - disabled: true + text: _('ID_DELETE'), + id: 'usersBtnDelete', + iconCls: 'button_menu_ext ss_sprite ss_delete', + handler: DeleteUserAction, + disabled: true }); groupsButton = new Ext.Action({ - text: _('ID_GROUPS'), - iconCls: 'button_menu_ext ss_sprite ss_group_add', - handler: UsersGroupPage, - disabled: true + text: _('ID_GROUPS'), + id: 'usersBtnGroups', + iconCls: 'button_menu_ext ss_sprite ss_group_add', + handler: UsersGroupPage, + disabled: true }); -// reassignButton = new Ext.Action({ -// text: _('ID_REASSIGN_CASES'), -// iconCls: 'button_menu_ext ss_sprite ss_arrow_rotate_clockwise', -// handler: DoNothing, -// disabled: true -// }); - authenticationButton = new Ext.Action({ - text: _('ID_AUTHENTICATION'), - iconCls: 'button_menu_ext ss_sprite ss_key', - handler: AuthUserPage, - disabled: true + text: _('ID_AUTHENTICATION'), + id: 'usersBtnAuthentication', + iconCls: 'button_menu_ext ss_sprite ss_key', + handler: AuthUserPage, + disabled: true }); From 855bc1d5ce37df2a66ad6e7b65be3a13c4ec61bc Mon Sep 17 00:00:00 2001 From: dheeyi william Date: Mon, 11 Sep 2017 14:09:53 -0400 Subject: [PATCH 05/85] FBI-623 Update main.js to remove eval that is used to register a pluggin --- workflow/engine/templates/processes/main.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/workflow/engine/templates/processes/main.js b/workflow/engine/templates/processes/main.js index 07f5a895f..e4792b50d 100644 --- a/workflow/engine/templates/processes/main.js +++ b/workflow/engine/templates/processes/main.js @@ -40,12 +40,9 @@ var supportedProcessTypes = { fn = fn.replace(/\s/g, "_"); fn = fn.replace(/\-/g, "_"); fn = fn + "DesignerGridRowDblClick"; - - // Todo We should remove eval functions as they are NSFW - eval("var flag = typeof(" + fn + ") == \"function\";"); - - if (flag) { - eval(fn + "(rowSelected.data);"); + fn = window[fn]; + if (typeof fn === "function") { + fn(rowSelected.data); } else { disabledProcessTypeMessage(); } From 22e026bb4628f2eff3ff23c83f7542329e5a35d1 Mon Sep 17 00:00:00 2001 From: Fabio Guachalla Date: Mon, 11 Sep 2017 16:21:04 -0400 Subject: [PATCH 06/85] FBI-841:incorrect window size on insert/editTable --- .../jscripts/tiny_mce/themes/advanced/skins/default/dialog.css | 2 +- .../tiny_mce/themes/advanced/skins/default/dialogTinyBpmn.css | 2 +- .../tiny_mce/themes/advanced/skins/highcontrast/dialog.css | 2 +- .../jscripts/tiny_mce/themes/advanced/skins/o2k7/dialog.css | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gulliver/js/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/dialog.css b/gulliver/js/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/dialog.css index 93e2f596c..6271e87b3 100644 --- a/gulliver/js/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/dialog.css +++ b/gulliver/js/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/dialog.css @@ -84,7 +84,7 @@ td.charmap, #charmap a {width:18px; height:18px; color:#000; border:1px solid #A /* Panels */ .panel_wrapper div.panel {display:none;} -.panel_wrapper div.current {display:block; width:100%; height:300px; overflow:visible;} +.panel_wrapper div.current {display:block; width:100%; height:220px; overflow:visible;} .panel_wrapper {border:1px solid #919B9C; border-top:0px; padding:10px; padding-top:5px; clear:both; background:white;} /* Columns */ diff --git a/gulliver/js/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/dialogTinyBpmn.css b/gulliver/js/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/dialogTinyBpmn.css index d8f579c06..dedaeeb3c 100644 --- a/gulliver/js/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/dialogTinyBpmn.css +++ b/gulliver/js/tinymce/jscripts/tiny_mce/themes/advanced/skins/default/dialogTinyBpmn.css @@ -140,7 +140,7 @@ td.charmap, #charmap a {width:18px; height:18px; color:#000; border:1px solid #A /* Panels */ .panel_wrapper div.panel {display:none;} -.panel_wrapper div.current {display:block; width:100%; height:300px; overflow:visible;} +.panel_wrapper div.current {display:block; width:100%; height:220px; overflow:visible;} .panel_wrapper {border:1px solid #919B9C; border-top:0px; padding:10px; padding-top:5px; clear:both; background:white;} /* Columns */ diff --git a/gulliver/js/tinymce/jscripts/tiny_mce/themes/advanced/skins/highcontrast/dialog.css b/gulliver/js/tinymce/jscripts/tiny_mce/themes/advanced/skins/highcontrast/dialog.css index 713d1a01e..acfa025d1 100644 --- a/gulliver/js/tinymce/jscripts/tiny_mce/themes/advanced/skins/highcontrast/dialog.css +++ b/gulliver/js/tinymce/jscripts/tiny_mce/themes/advanced/skins/highcontrast/dialog.css @@ -73,7 +73,7 @@ td.charmap, #charmap a {width:18px; height:18px; color:#000; border:1px solid #A /* Panels */ .panel_wrapper div.panel {display:none;} -.panel_wrapper div.current {display:block; width:100%; height:300px; overflow:visible;} +.panel_wrapper div.current {display:block; width:100%; height:220px; overflow:visible;} .panel_wrapper {border:1px solid #919B9C; padding:10px; padding-top:5px; clear:both; background:white;} /* Columns */ diff --git a/gulliver/js/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/dialog.css b/gulliver/js/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/dialog.css index 93d06a7be..7433cdfb9 100644 --- a/gulliver/js/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/dialog.css +++ b/gulliver/js/tinymce/jscripts/tiny_mce/themes/advanced/skins/o2k7/dialog.css @@ -84,7 +84,7 @@ td.charmap, #charmap a {width:18px; height:18px; color:#000; border:1px solid #A /* Panels */ .panel_wrapper div.panel {display:none;} -.panel_wrapper div.current {display:block; width:100%; height:300px; overflow:visible;} +.panel_wrapper div.current {display:block; width:100%; height:220px; overflow:visible;} .panel_wrapper {border:1px solid #919B9C; border-top:0px; padding:10px; padding-top:5px; clear:both; background:white;} /* Columns */ From e28e99d3d7e85d4d5985337df1a0fd92eae24540 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Tue, 12 Sep 2017 17:00:06 -0400 Subject: [PATCH 07/85] HOR-3221 --- workflow/engine/classes/LdapAdvanced.php | 517 +++++++++++------------ 1 file changed, 245 insertions(+), 272 deletions(-) diff --git a/workflow/engine/classes/LdapAdvanced.php b/workflow/engine/classes/LdapAdvanced.php index 95f3ba322..b251b488c 100644 --- a/workflow/engine/classes/LdapAdvanced.php +++ b/workflow/engine/classes/LdapAdvanced.php @@ -41,21 +41,17 @@ class LdapAdvanced * @var Object */ private static $instance = null; - private $arrayObjectClassFilter = array( - "user" => "|(objectclass=inetorgperson)(objectclass=organizationalperson)(objectclass=person)(objectclass=user)", - "group" => "|(objectclass=posixgroup)(objectclass=group)(objectclass=groupofuniquenames)", + "user" => "|(objectclass=inetorgperson)(objectclass=organizationalperson)(objectclass=person)(objectclass=user)", + "group" => "|(objectclass=posixgroup)(objectclass=group)(objectclass=groupofuniquenames)", "department" => "|(objectclass=organizationalunit)" ); - private $arrayAttributes = array( - "ldap" => array("uid" => "uid", "member" => "memberuid"), //OpenLDAP - "ad" => array("uid" => "samaccountname", "member" => "member"), //Active Directory - "ds" => array("uid" => "uid", "member" => "uniquemember") //389 DS + "ldap" => array("uid" => "uid", "member" => "memberuid"), //OpenLDAP + "ad" => array("uid" => "samaccountname", "member" => "member"), //Active Directory + "ds" => array("uid" => "uid", "member" => "uniquemember") //389 DS ); - private $arrayAttributesForUser = array("dn", "uid", "samaccountname", "givenname", "sn", "cn", "mail", "userprincipalname", "useraccountcontrol", "accountexpires", "manager"); - private $frontEnd = false; private $debug = false; public $arrayAuthenticationSourceUsersByUid = array(); @@ -64,7 +60,6 @@ class LdapAdvanced public $arrayDepartmentUsersByUsername = array(); public $arrayGroupUsersByUid = array(); public $arrayGroupUsersByUsername = array(); - private $arrayDepartmentUserSynchronizedChecked = array(); private $arrayUserUpdateChecked = array(); @@ -73,6 +68,7 @@ class LdapAdvanced */ public function __construct() { + } /** @@ -156,8 +152,8 @@ class LdapAdvanced { try { $arrayUserData = array( - "USR_UID" => $userUid, - "USR_USERNAME" => $arrayUserLdap["sUsername"], + "USR_UID" => $userUid, + "USR_USERNAME" => $arrayUserLdap["sUsername"], "USR_AUTH_USER_DN" => $arrayUserLdap["sDN"] ); @@ -299,8 +295,8 @@ class LdapAdvanced public function progressBar($total, $count) { try { - $p = (int)(($count * 100) / $total); - $n = (int)($p / 2); + $p = (int) (($count * 100) / $total); + $n = (int) ($p / 2); return "[" . str_repeat("|", $n) . str_repeat(" ", 50 - $n) . "] $p%"; } catch (Exception $e) { @@ -371,7 +367,6 @@ class LdapAdvanced unset($arrayCharacter[124]); //| unset($arrayCharacter[126]); //~ unset($arrayCharacter[127]); //DEL - //Return return array_unique($arrayCharacter); } catch (Exception $e) { @@ -459,7 +454,7 @@ class LdapAdvanced $logFile = PATH_DATA . "log/ldapAdvanced.log"; if (!file_exists($logFile) || is_writable($logFile)) { - $fpt= fopen($logFile, "a"); + $fpt = fopen($logFile, "a"); $ldapErrorMsg = ""; $ldapErrorNr = 0; @@ -517,7 +512,7 @@ class LdapAdvanced $ldapcnn = ldap_connect($aAuthSource['AUTH_SOURCE_SERVER_NAME'], $aAuthSource['AUTH_SOURCE_PORT']); - $ldapServer = $aAuthSource["AUTH_SOURCE_SERVER_NAME"] . ":" . $aAuthSource["AUTH_SOURCE_PORT"] ; + $ldapServer = $aAuthSource["AUTH_SOURCE_SERVER_NAME"] . ":" . $aAuthSource["AUTH_SOURCE_PORT"]; ldap_set_option($ldapcnn, LDAP_OPT_PROTOCOL_VERSION, 3); ldap_set_option($ldapcnn, LDAP_OPT_REFERRALS, 0); @@ -623,7 +618,7 @@ class LdapAdvanced do { $arrayUserLdap = $this->ldapGetAttributes($ldapcnn, $entry); - $username = (isset($arrayUserLdap[$uidUserIdentifier]))? $arrayUserLdap[$uidUserIdentifier] : ""; + $username = (isset($arrayUserLdap[$uidUserIdentifier])) ? $arrayUserLdap[$uidUserIdentifier] : ""; $countUser++; @@ -704,11 +699,11 @@ class LdapAdvanced $arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["AUTH_SOURCE_USERS_FILTER"] = ""; } - $uidUserIdentifier = (isset($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["AUTH_SOURCE_IDENTIFIER_FOR_USER"]))? $arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["AUTH_SOURCE_IDENTIFIER_FOR_USER"] : "uid"; + $uidUserIdentifier = (isset($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["AUTH_SOURCE_IDENTIFIER_FOR_USER"])) ? $arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["AUTH_SOURCE_IDENTIFIER_FOR_USER"] : "uid"; $filterUsers = trim($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["AUTH_SOURCE_USERS_FILTER"]); - $filter = ($filterUsers != "")? $filterUsers : "(" . $this->arrayObjectClassFilter["user"] . ")"; + $filter = ($filterUsers != "") ? $filterUsers : "(" . $this->arrayObjectClassFilter["user"] . ")"; $this->debugLog("class.ldapAdvanced.php > function ldapGetUsersFromDepartment() > \$filter ----> $filter"); @@ -748,7 +743,7 @@ class LdapAdvanced $ldapcnn = $this->ldapConnection($arrayAuthenticationSourceData); - $filter = ($filterUsers != "")? $filterUsers : "(" . $this->arrayObjectClassFilter["user"] . ")"; + $filter = ($filterUsers != "") ? $filterUsers : "(" . $this->arrayObjectClassFilter["user"] . ")"; $filter = "(&$filter($uidUserIdentifier=$char*))"; $this->debugLog("class.ldapAdvanced.php > function ldapGetUsersFromDepartment() > \$filter ----> $filter"); @@ -805,13 +800,9 @@ class LdapAdvanced * @return array Return array data */ private function __ldapGroupSynchronizeMembers( - $ldapcnn, - array $arrayAuthSourceData, - $groupUid, - array $arrayGroupLdap, - $memberAttribute, - array $arrayData = [] - ) { + $ldapcnn, array $arrayAuthSourceData, $groupUid, array $arrayGroupLdap, $memberAttribute, array $arrayData = [] + ) + { try { unset($arrayData['countMembers']); @@ -820,12 +811,12 @@ class LdapAdvanced $arrayAuthSourceData['AUTH_SOURCE_DATA']['AUTH_SOURCE_USERS_FILTER'] = ''; } - $uidUserIdentifier = (isset($arrayAuthSourceData['AUTH_SOURCE_DATA']['AUTH_SOURCE_IDENTIFIER_FOR_USER']))? - $arrayAuthSourceData['AUTH_SOURCE_DATA']['AUTH_SOURCE_IDENTIFIER_FOR_USER'] : 'uid'; + $uidUserIdentifier = (isset($arrayAuthSourceData['AUTH_SOURCE_DATA']['AUTH_SOURCE_IDENTIFIER_FOR_USER'])) ? + $arrayAuthSourceData['AUTH_SOURCE_DATA']['AUTH_SOURCE_IDENTIFIER_FOR_USER'] : 'uid'; $filterUsers = trim($arrayAuthSourceData['AUTH_SOURCE_DATA']['AUTH_SOURCE_USERS_FILTER']); - $filter = ($filterUsers != '')? $filterUsers : '(' . $this->arrayObjectClassFilter['user'] . ')'; + $filter = ($filterUsers != '') ? $filterUsers : '(' . $this->arrayObjectClassFilter['user'] . ')'; if (isset($arrayGroupLdap[$memberAttribute])) { if (!is_array($arrayGroupLdap[$memberAttribute])) { @@ -850,21 +841,20 @@ class LdapAdvanced $arrayUserLdap = $this->ldapGetAttributes($ldapcnn, $entry); - $username = (isset($arrayUserLdap[$uidUserIdentifier]))? $arrayUserLdap[$uidUserIdentifier] : ''; + $username = (isset($arrayUserLdap[$uidUserIdentifier])) ? $arrayUserLdap[$uidUserIdentifier] : ''; - $arrayData['countUser']++; + $arrayData['countUser'] ++; if ((is_array($username) && !empty($username)) || trim($username) != '') { $arrayData = $this->groupSynchronizeUser( - $groupUid, $this->getUserDataFromAttribute($username, $arrayUserLdap), $arrayData + $groupUid, $this->getUserDataFromAttribute($username, $arrayUserLdap), $arrayData ); } //Progress bar $this->frontEndShow( - 'BAR', - 'Groups: ' . $arrayData['i'] . '/' . $arrayData['n'] . ' ' . - $this->progressBar($arrayData['totalUser'], $arrayData['countUser']) + 'BAR', 'Groups: ' . $arrayData['i'] . '/' . $arrayData['n'] . ' ' . + $this->progressBar($arrayData['totalUser'], $arrayData['countUser']) ); } } @@ -954,18 +944,13 @@ class LdapAdvanced } $arrayData = $this->__ldapGroupSynchronizeMembers( - $ldapcnn, - $arrayAuthenticationSourceData, - $arrayGroupData['GRP_UID'], - $arrayGroupLdap, - $memberAttribute2, - array_merge($arrayData, ['totalUser' => $totalUser, 'countUser' => $countUser]) + $ldapcnn, $arrayAuthenticationSourceData, $arrayGroupData['GRP_UID'], $arrayGroupLdap, $memberAttribute2, array_merge($arrayData, ['totalUser' => $totalUser, 'countUser' => $countUser]) ); $totalUser = $arrayData['totalUser']; $countUser = $arrayData['countUser']; - $limitMemberRange = (isset($arrayData['countMembers']))? $arrayData['countMembers'] : 0; + $limitMemberRange = (isset($arrayData['countMembers'])) ? $arrayData['countMembers'] : 0; if ($flagMemberRange) { for ($start = $limitMemberRange; true; $start += $limitMemberRange) { @@ -992,12 +977,7 @@ class LdapAdvanced } $arrayData = $this->__ldapGroupSynchronizeMembers( - $ldapcnn, - $arrayAuthenticationSourceData, - $arrayGroupData['GRP_UID'], - $arrayGroupLdap, - $memberAttribute2, - array_merge($arrayData, ['totalUser' => $totalUser, 'countUser' => $countUser]) + $ldapcnn, $arrayAuthenticationSourceData, $arrayGroupData['GRP_UID'], $arrayGroupLdap, $memberAttribute2, array_merge($arrayData, ['totalUser' => $totalUser, 'countUser' => $countUser]) ); $totalUser = $arrayData['totalUser']; @@ -1042,9 +1022,9 @@ class LdapAdvanced public function VerifyLogin($strUser, $strPass) { if (is_array($strUser)) { - $strUser = $strUser[0]; + $strUser = $strUser[0]; } else { - $strUser = trim($strUser); + $strUser = trim($strUser); } if ($strUser == "") { @@ -1075,7 +1055,7 @@ class LdapAdvanced $setAttributes = 0; if (isset($arrayAuthSource['AUTH_SOURCE_DATA']['AUTH_SOURCE_SHOWGRID']) && - $arrayAuthSource['AUTH_SOURCE_DATA']['AUTH_SOURCE_SHOWGRID'] == 'on' + $arrayAuthSource['AUTH_SOURCE_DATA']['AUTH_SOURCE_SHOWGRID'] == 'on' ) { $setAttributes = 1; } @@ -1098,47 +1078,50 @@ class LdapAdvanced $usrName = $row["USR_USERNAME"]; $usrUid = $row["USR_UID"]; - //Get the AuthSource properties - //Check if the dn in the database record matches with the dn for the ldap account - $verifiedUser = $this->searchUserByUid( - $usrName, - $arrayAuthSource["AUTH_SOURCE_DATA"]["AUTH_SOURCE_IDENTIFIER_FOR_USER"] - ); - - if (empty($verifiedUser) || trim($verifiedUser["sDN"]) == null) { - return -1; - } - $userDn = $strUser; - if ($verifiedUser["sDN"] != $strUser || $setAttributes==1) { - $userDn = $verifiedUser['sDN']; + //Get the AuthSource properties + //Check if the dn in the database record matches with the dn for the ldap account + try { + $verifiedUser = $this->searchUserByUid($usrName, $arrayAuthSource["AUTH_SOURCE_DATA"]["AUTH_SOURCE_IDENTIFIER_FOR_USER"]); - //Update data - $user = new \ProcessMaker\BusinessModel\User(); - $arrayUserData = $user->getUserRecordByPk($usrUid, [], false); + if (empty($verifiedUser) || trim($verifiedUser["sDN"]) == null) { + return -1; + } + if ($verifiedUser["sDN"] != $strUser || $setAttributes == 1) { + $userDn = $verifiedUser['sDN']; - $result = $this->__ldapUserUpdateByDnAndData( - $this->ldapcnn, $arrayAuthSource, $userDn, [$arrayUserData['USR_USERNAME'] => $arrayUserData] - ); + //Update data + $user = new \ProcessMaker\BusinessModel\User(); + $arrayUserData = $user->getUserRecordByPk($usrUid, [], false); - //Update DN - $con = Propel::getConnection(RbacUsersPeer::DATABASE_NAME); - // select set - $c1 = new Criteria("rbac"); - $c1->add(RbacUsersPeer::UID_AUTH_SOURCE, $arrayAuthSource["AUTH_SOURCE_UID"]); - $c1->add(RbacUsersPeer::USR_AUTH_USER_DN, $strUser); - // update set - $c2 = new Criteria("rbac"); - $c2->add(RbacUsersPeer::USR_AUTH_USER_DN, $userDn); + $result = $this->__ldapUserUpdateByDnAndData( + $this->ldapcnn, $arrayAuthSource, $userDn, [$arrayUserData['USR_USERNAME'] => $arrayUserData] + ); - BasePeer::doUpdate($c1, $c2, $con); + //Update DN + $con = Propel::getConnection(RbacUsersPeer::DATABASE_NAME); + // select set + $c1 = new Criteria("rbac"); + $c1->add(RbacUsersPeer::UID_AUTH_SOURCE, $arrayAuthSource["AUTH_SOURCE_UID"]); + $c1->add(RbacUsersPeer::USR_AUTH_USER_DN, $strUser); + // update set + $c2 = new Criteria("rbac"); + $c2->add(RbacUsersPeer::USR_AUTH_USER_DN, $userDn); + + BasePeer::doUpdate($c1, $c2, $con); + } + } catch (Exception $e) { + $context = Bootstrap::getDefaultContextLog(); + $context["action"] = "ldapSynchronize"; + $context["authSource"] = $arrayAuthSource; + Bootstrap::registerMonolog("ldapSynchronize", 400, $e->getMessage(), $context, $context["workspace"], "processmaker.log"); } //Check ldap connection for user - $arrayAuthSource["AUTH_ANONYMOUS"] = "0"; + $arrayAuthSource["AUTH_ANONYMOUS"] = "0"; $arrayAuthSource["AUTH_SOURCE_SEARCH_USER"] = $userDn; - $arrayAuthSource["AUTH_SOURCE_PASSWORD"] = $strPass; + $arrayAuthSource["AUTH_SOURCE_PASSWORD"] = $strPass; $ldapcnn = $this->ldapConnection($arrayAuthSource); $flagUpdate = false; @@ -1169,7 +1152,7 @@ class LdapAdvanced $c1->add(RbacUsersPeer::USR_AUTH_USER_DN, $strUser); // update set $c2 = new Criteria("rbac"); - $c2->add(RbacUsersPeer::USR_AUTH_USER_DN, $verifiedUser["sDN"]); + $c2->add(RbacUsersPeer::USR_AUTH_USER_DN, $userDn); $c2->add(RbacUsersPeer::USR_STATUS, $statusRbac); BasePeer::doUpdate($c1, $c2, $con); $columnsWf = array(); @@ -1186,7 +1169,7 @@ class LdapAdvanced } //Check if the user is in the terminated organizational unit - if ($this->userIsTerminated($usrName, $attributes["AUTH_SOURCE_RETIRED_OU"])) { + if (!empty($verifiedUser) && $this->userIsTerminated($usrName, $attributes["AUTH_SOURCE_RETIRED_OU"])) { $this->deactivateUser($usrName); $this->log($ldapcnn, "user $strUser is member of Remove OU, deactivating this user."); @@ -1203,7 +1186,7 @@ class LdapAdvanced $this->log($ldapcnn, "failure authentication for user $strUser"); } - return $validUserPass ; + return $validUserPass; } /** @@ -1217,17 +1200,17 @@ class LdapAdvanced public function getUserDataFromAttribute($username, array $arrayAttributes) { try { - $keyMail = (isset($arrayAttributes["mail"]))? "mail" : ((isset($arrayAttributes["userprincipalname"]))? "userprincipalname" : "nomail"); + $keyMail = (isset($arrayAttributes["mail"])) ? "mail" : ((isset($arrayAttributes["userprincipalname"])) ? "userprincipalname" : "nomail"); return array( - "sUsername" => trim((is_array($username))? $username[0] : $username), - "sPassword" => trim((isset($arrayAttributes["userpassword"]))? ((is_array($arrayAttributes["userpassword"]))? $arrayAttributes["userpassword"][0] : $arrayAttributes["userpassword"]) : ""), - "sFullname" => trim((isset($arrayAttributes["cn"]))? ((is_array($arrayAttributes["cn"]))? $arrayAttributes["cn"][0] : $arrayAttributes["cn"]) : ""), - "sFirstname" => trim((isset($arrayAttributes["givenname"]))? ((is_array($arrayAttributes["givenname"]))? $arrayAttributes["givenname"][0] : $arrayAttributes["givenname"]) : ""), - "sLastname" => trim((isset($arrayAttributes["sn"]))? ((is_array($arrayAttributes["sn"]))? $arrayAttributes["sn"][0] : $arrayAttributes["sn"]) : ""), - "sEmail" => trim((isset($arrayAttributes[$keyMail]))? ((is_array($arrayAttributes[$keyMail]))? $arrayAttributes[$keyMail][0] : $arrayAttributes[$keyMail]) : ""), - "sDN" => trim($arrayAttributes["dn"]), - "sManagerDN" => trim((isset($arrayAttributes["manager"]))? ((is_array($arrayAttributes["manager"]))? $arrayAttributes["manager"][0] : $arrayAttributes["manager"]) : "") + "sUsername" => trim((is_array($username)) ? $username[0] : $username), + "sPassword" => trim((isset($arrayAttributes["userpassword"])) ? ((is_array($arrayAttributes["userpassword"])) ? $arrayAttributes["userpassword"][0] : $arrayAttributes["userpassword"]) : ""), + "sFullname" => trim((isset($arrayAttributes["cn"])) ? ((is_array($arrayAttributes["cn"])) ? $arrayAttributes["cn"][0] : $arrayAttributes["cn"]) : ""), + "sFirstname" => trim((isset($arrayAttributes["givenname"])) ? ((is_array($arrayAttributes["givenname"])) ? $arrayAttributes["givenname"][0] : $arrayAttributes["givenname"]) : ""), + "sLastname" => trim((isset($arrayAttributes["sn"])) ? ((is_array($arrayAttributes["sn"])) ? $arrayAttributes["sn"][0] : $arrayAttributes["sn"]) : ""), + "sEmail" => trim((isset($arrayAttributes[$keyMail])) ? ((is_array($arrayAttributes[$keyMail])) ? $arrayAttributes[$keyMail][0] : $arrayAttributes[$keyMail]) : ""), + "sDN" => trim($arrayAttributes["dn"]), + "sManagerDN" => trim((isset($arrayAttributes["manager"])) ? ((is_array($arrayAttributes["manager"])) ? $arrayAttributes["manager"][0] : $arrayAttributes["manager"]) : "") ); } catch (Exception $e) { throw $e; @@ -1247,7 +1230,7 @@ class LdapAdvanced $countUser = 0; $keyword = trim(trim($keyword), "*"); - $keyword = ($keyword != "")? "*$keyword*" : "*"; + $keyword = ($keyword != "") ? "*$keyword*" : "*"; $paged = !is_null($start) && !is_null($limit); @@ -1261,8 +1244,7 @@ class LdapAdvanced $attributeUserSet = array(); $attributeSetAdd = array(); - if (isset($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["AUTH_SOURCE_GRID_ATTRIBUTE"]) - && !empty($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["AUTH_SOURCE_GRID_ATTRIBUTE"]) + if (isset($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["AUTH_SOURCE_GRID_ATTRIBUTE"]) && !empty($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["AUTH_SOURCE_GRID_ATTRIBUTE"]) ) { foreach ($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["AUTH_SOURCE_GRID_ATTRIBUTE"] as $value) { $attributeSetAdd[] = $value['attributeLdap']; @@ -1281,11 +1263,11 @@ class LdapAdvanced $arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["AUTH_SOURCE_USERS_FILTER"] = ""; } - $uidUserIdentifier = (isset($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["AUTH_SOURCE_IDENTIFIER_FOR_USER"]))? $arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["AUTH_SOURCE_IDENTIFIER_FOR_USER"] : "uid"; + $uidUserIdentifier = (isset($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["AUTH_SOURCE_IDENTIFIER_FOR_USER"])) ? $arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["AUTH_SOURCE_IDENTIFIER_FOR_USER"] : "uid"; $filterUsers = trim($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["AUTH_SOURCE_USERS_FILTER"]); - $filter = ($filterUsers != "")? $filterUsers : "(" . $this->arrayObjectClassFilter["user"] . ")"; + $filter = ($filterUsers != "") ? $filterUsers : "(" . $this->arrayObjectClassFilter["user"] . ")"; $filter = "(&$filter(|(dn=$keyword)(uid=$keyword)(samaccountname=$keyword)(givenname=$keyword)(sn=$keyword)(cn=$keyword)(mail=$keyword)(userprincipalname=$keyword)))"; $oSearch = @ldap_search($ldapcnn, $arrayAuthenticationSourceData["AUTH_SOURCE_BASE_DN"], $filter, array_merge($this->arrayAttributesForUser, $attributeSetAdd)); @@ -1300,49 +1282,49 @@ class LdapAdvanced if ($entries > 0) { $oEntry = ldap_first_entry($ldapcnn, $oSearch); - $countEntries=0; + $countEntries = 0; $flagNextRecord = true; do { $aAttr = $this->ldapGetAttributes($ldapcnn, $oEntry); - $sUsername = (isset($aAttr[$uidUserIdentifier]))? $aAttr[$uidUserIdentifier] : ""; + $sUsername = (isset($aAttr[$uidUserIdentifier])) ? $aAttr[$uidUserIdentifier] : ""; if ((is_array($sUsername) && !empty($sUsername)) || trim($sUsername) != "") { $countUser++; - /*Active Directory userAccountControl Values - Normal Day to Day Values: - 512 - Enable Account - 514 - Disable account - 544 - Account Enabled - Require user to change password at first logon - 4096 - Workstation/server - 66048 - Enabled, password never expires - 66050 - Disabled, password never expires - 262656 - Smart Card Logon Required - 532480 - Domain controller - 1 - script - 2 - accountdisable - 8 - homedir_required - 16 - lockout - 32 - passwd_notreqd - 64 - passwd_cant_change - 128 - encrypted_text_pwd_allowed - 256 - temp_duplicate_account - 512 - normal_account - 2048 - interdomain_trust_account - 4096 - workstation_trust_account - 8192 - server_trust_account - 65536 - dont_expire_password - 131072 - mns_logon_account - 262144 - smartcard_required - 524288 - trusted_for_delegation - 1048576 - not_delegated - 2097152 - use_des_key_only - 4194304 - dont_req_preauth - 8388608 - password_expired - 16777216 - trusted_to_auth_for_delegation - */ + /* Active Directory userAccountControl Values + Normal Day to Day Values: + 512 - Enable Account + 514 - Disable account + 544 - Account Enabled - Require user to change password at first logon + 4096 - Workstation/server + 66048 - Enabled, password never expires + 66050 - Disabled, password never expires + 262656 - Smart Card Logon Required + 532480 - Domain controller + 1 - script + 2 - accountdisable + 8 - homedir_required + 16 - lockout + 32 - passwd_notreqd + 64 - passwd_cant_change + 128 - encrypted_text_pwd_allowed + 256 - temp_duplicate_account + 512 - normal_account + 2048 - interdomain_trust_account + 4096 - workstation_trust_account + 8192 - server_trust_account + 65536 - dont_expire_password + 131072 - mns_logon_account + 262144 - smartcard_required + 524288 - trusted_for_delegation + 1048576 - not_delegated + 2097152 - use_des_key_only + 4194304 - dont_req_preauth + 8388608 - password_expired + 16777216 - trusted_to_auth_for_delegation + */ $userCountControl = ''; //Active Directory, openLdap if (isset($aAttr['useraccountcontrol'])) { @@ -1373,8 +1355,8 @@ class LdapAdvanced foreach ($attributeUserSet as $key => $value) { if ($key == 'USR_STATUS') { $aUserAttributes[$key] = ($userCountControl != '') ? $userCountControl : 'ACTIVE'; - } elseif (isset($aAttr[ $value ])) { - $aUserAttributes[$key] = $aAttr[ $value ]; + } elseif (isset($aAttr[$value])) { + $aUserAttributes[$key] = $aAttr[$value]; } } @@ -1396,18 +1378,18 @@ class LdapAdvanced } } /* - $sUsers = "found $countEntries users: "; + $sUsers = "found $countEntries users: "; - foreach ($aUsers as $key => $val) { - $sUsers .= $val['sUsername'] . ' '; - } + foreach ($aUsers as $key => $val) { + $sUsers .= $val['sUsername'] . ' '; + } - $this->log($ldapcnn, $sUsers); - */ + $this->log($ldapcnn, $sUsers); + */ } //Return - return ($paged)? array("numRecTotal" => $totalUser, "data" => $arrayUser) : $arrayUser; + return ($paged) ? array("numRecTotal" => $totalUser, "data" => $arrayUser) : $arrayUser; } /** @@ -1442,8 +1424,7 @@ class LdapAdvanced $attributeUserSet = array(); $attributeSetAdd = array(); - if (isset($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["AUTH_SOURCE_GRID_ATTRIBUTE"]) - && !empty($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["AUTH_SOURCE_GRID_ATTRIBUTE"]) + if (isset($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["AUTH_SOURCE_GRID_ATTRIBUTE"]) && !empty($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["AUTH_SOURCE_GRID_ATTRIBUTE"]) ) { foreach ($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["AUTH_SOURCE_GRID_ATTRIBUTE"] as $value) { $attributeSetAdd[] = $value["attributeLdap"]; @@ -1451,7 +1432,7 @@ class LdapAdvanced } } - $uidUserIdentifier = (isset($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["AUTH_SOURCE_IDENTIFIER_FOR_USER"]))? $arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["AUTH_SOURCE_IDENTIFIER_FOR_USER"] : "uid"; + $uidUserIdentifier = (isset($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["AUTH_SOURCE_IDENTIFIER_FOR_USER"])) ? $arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["AUTH_SOURCE_IDENTIFIER_FOR_USER"] : "uid"; $filter2 = ""; @@ -1474,7 +1455,7 @@ class LdapAdvanced $arrayUserLdap = $this->ldapGetAttributes($ldapcnn, $entry); - $username = (isset($arrayUserLdap[$uidUserIdentifier]))? $arrayUserLdap[$uidUserIdentifier] : ""; + $username = (isset($arrayUserLdap[$uidUserIdentifier])) ? $arrayUserLdap[$uidUserIdentifier] : ""; if ((is_array($username) && !empty($username)) || trim($username) != "") { $userCountControl = ""; @@ -1510,7 +1491,7 @@ class LdapAdvanced foreach ($attributeUserSet as $key => $value) { if ($key == "USR_STATUS") { - $aUserAttributes[$key] = ($userCountControl != "")? $userCountControl : "ACTIVE"; + $aUserAttributes[$key] = ($userCountControl != "") ? $userCountControl : "ACTIVE"; } else { if (isset($arrayUserLdap[$value])) { $aUserAttributes[$key] = $arrayUserLdap[$value]; @@ -1552,7 +1533,7 @@ class LdapAdvanced $res = 1; } - if ($res == 0 && $this->VerifyLogin($user['sDN'], $strPass) === true) { + if ($res == 0 && $this->VerifyLogin($user['sDN'], $strPass) === true) { $res = 1; } } else { @@ -1568,20 +1549,20 @@ class LdapAdvanced } $aData = array(); - $aData['USR_USERNAME'] = $user['sUsername']; - $aData["USR_PASSWORD"] = "00000000000000000000000000000000"; - $aData['USR_FIRSTNAME'] = $user['sFirstname']; - $aData['USR_LASTNAME'] = $user['sLastname']; - $aData['USR_EMAIL'] = $user['sEmail']; - $aData['USR_DUE_DATE'] = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 2)); - $aData['USR_CREATE_DATE'] = date('Y-m-d H:i:s'); - $aData['USR_UPDATE_DATE'] = date('Y-m-d H:i:s'); - $aData['USR_BIRTHDAY'] = date('Y-m-d'); - $aData['USR_STATUS'] = (isset($user['USR_STATUS'])) ? (($user['USR_STATUS'] == 'ACTIVE') ? 1 : 0) : 1; - $aData['USR_AUTH_TYPE'] = strtolower($aAuthSource['AUTH_SOURCE_PROVIDER']); - $aData['UID_AUTH_SOURCE'] = $aAuthSource['AUTH_SOURCE_UID']; + $aData['USR_USERNAME'] = $user['sUsername']; + $aData["USR_PASSWORD"] = "00000000000000000000000000000000"; + $aData['USR_FIRSTNAME'] = $user['sFirstname']; + $aData['USR_LASTNAME'] = $user['sLastname']; + $aData['USR_EMAIL'] = $user['sEmail']; + $aData['USR_DUE_DATE'] = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 2)); + $aData['USR_CREATE_DATE'] = date('Y-m-d H:i:s'); + $aData['USR_UPDATE_DATE'] = date('Y-m-d H:i:s'); + $aData['USR_BIRTHDAY'] = date('Y-m-d'); + $aData['USR_STATUS'] = (isset($user['USR_STATUS'])) ? (($user['USR_STATUS'] == 'ACTIVE') ? 1 : 0) : 1; + $aData['USR_AUTH_TYPE'] = strtolower($aAuthSource['AUTH_SOURCE_PROVIDER']); + $aData['UID_AUTH_SOURCE'] = $aAuthSource['AUTH_SOURCE_UID']; $aData['USR_AUTH_USER_DN'] = $user['sDN']; - $aData['USR_ROLE'] = 'PROCESSMAKER_OPERATOR'; + $aData['USR_ROLE'] = 'PROCESSMAKER_OPERATOR'; if (!empty($aAttributes)) { foreach ($aAttributes as $value) { @@ -1589,7 +1570,7 @@ class LdapAdvanced $aData[$value['attributeUser']] = str_replace("*", "'", $user[$value['attributeUser']]); if ($value['attributeUser'] == 'USR_STATUS') { $evalValue = $aData[$value['attributeUser']]; - $statusValue = (isset($user['USR_STATUS'])) ? $user['USR_STATUS'] :'ACTIVE'; + $statusValue = (isset($user['USR_STATUS'])) ? $user['USR_STATUS'] : 'ACTIVE'; $aData[$value['attributeUser']] = $statusValue; } } @@ -1597,7 +1578,7 @@ class LdapAdvanced } //req - accountexpires - if (isset($user["USR_DUE_DATE"]) && $user["USR_DUE_DATE"]!='') { + if (isset($user["USR_DUE_DATE"]) && $user["USR_DUE_DATE"] != '') { $aData["USR_DUE_DATE"] = $this->convertDateADtoPM($user["USR_DUE_DATE"]); } //end @@ -1608,7 +1589,7 @@ class LdapAdvanced require_once 'classes/model/Users.php'; $oUser = new Users(); - $aData['USR_STATUS'] = (isset($user['USR_STATUS'])) ? $user['USR_STATUS'] : 'ACTIVE'; + $aData['USR_STATUS'] = (isset($user['USR_STATUS'])) ? $user['USR_STATUS'] : 'ACTIVE'; $oUser->create($aData); $this->log(null, "Automatic Register for user $strUser "); $res = 1; @@ -1667,10 +1648,10 @@ class LdapAdvanced //The first node is root if (empty($arrayDepartment)) { $arrayDepartment[] = [ - 'dn' => $arrayAuthenticationSourceData['AUTH_SOURCE_BASE_DN'], + 'dn' => $arrayAuthenticationSourceData['AUTH_SOURCE_BASE_DN'], 'parent' => '', - 'ou' => 'ROOT', - 'users' => 0 + 'ou' => 'ROOT', + 'users' => 0 ]; } @@ -1692,10 +1673,10 @@ class LdapAdvanced if (isset($arrayEntryData['ou']) && !is_array($arrayEntryData['ou'])) { $arrayDepartment[] = [ - 'dn' => $arrayEntryData['dn'], - 'parent' => (isset($unitsEqual[1]))? implode(',', $unitsEqual) : '', - 'ou' => trim($arrayEntryData['ou']), - 'users' => 0 + 'dn' => $arrayEntryData['dn'], + 'parent' => (isset($unitsEqual[1])) ? implode(',', $unitsEqual) : '', + 'ou' => trim($arrayEntryData['ou']), + 'users' => 0 ]; } } while ($entry = ldap_next_entry($ldapcnn, $entry)); @@ -1714,7 +1695,7 @@ class LdapAdvanced $str .= ' ' . $dep['ou']; } - $this->log($ldapcnn, 'found '. count($arrayDepartment) . ' departments: ' . $str); + $this->log($ldapcnn, 'found ' . count($arrayDepartment) . ' departments: ' . $str); //Return return $arrayDepartment; @@ -1842,18 +1823,18 @@ class LdapAdvanced return $terminated; } - /* activate an user previously deactivated if user is now in another department, we need the second parameter, the depUid @param string $userUid @param string optional department DN @param string optional DepUid - */ + */ + public function activateUser($userUid, $userDn = null, $depUid = null) { if (!class_exists('RbacUsers')) { - require_once(PATH_RBAC.'model/RbacUsers.php'); + require_once(PATH_RBAC . 'model/RbacUsers.php'); } $con = Propel::getConnection(RbacUsersPeer::DATABASE_NAME); @@ -1893,7 +1874,7 @@ class LdapAdvanced public function deactivateUser($userUid) { if (!class_exists('RbacUsers')) { - require_once(PATH_RBAC.'model/RbacUsers.php'); + require_once(PATH_RBAC . 'model/RbacUsers.php'); } $con = Propel::getConnection(RbacUsersPeer::DATABASE_NAME); @@ -1924,11 +1905,11 @@ class LdapAdvanced public function getTerminatedOu() { - if (trim($this->sAuthSource)!='') { + if (trim($this->sAuthSource) != '') { $rbac = &RBAC::getSingleton(); $aAuthSource = $rbac->authSourcesObj->load($this->sAuthSource); $attributes = $aAuthSource['AUTH_SOURCE_DATA']; - $this->sTerminatedOu = isset($attributes['AUTH_SOURCE_RETIRED_OU'])?$attributes['AUTH_SOURCE_RETIRED_OU']:''; + $this->sTerminatedOu = isset($attributes['AUTH_SOURCE_RETIRED_OU']) ? $attributes['AUTH_SOURCE_RETIRED_OU'] : ''; } return $this->sTerminatedOu; @@ -1940,10 +1921,10 @@ class LdapAdvanced returns only AUTH_SOURCE_PROVIDER = ldapAdvanced @return array with authsources with type = ldap - */ + */ public function getAuthSources() { - require_once(PATH_RBAC.'model/AuthenticationSource.php'); + require_once(PATH_RBAC . 'model/AuthenticationSource.php'); $oCriteria = new Criteria('rbac'); $aAuthSources = array(); @@ -1957,7 +1938,7 @@ class LdapAdvanced $aRow = $oDataset->getRow(); if ($aRow['AUTH_SOURCE_PROVIDER'] == 'ldapAdvanced') { - $aRow["AUTH_SOURCE_DATA"] = ($aRow["AUTH_SOURCE_DATA"] != "")? unserialize($aRow["AUTH_SOURCE_DATA"]) : array(); + $aRow["AUTH_SOURCE_DATA"] = ($aRow["AUTH_SOURCE_DATA"] != "") ? unserialize($aRow["AUTH_SOURCE_DATA"]) : array(); $aAuthSources[] = $aRow; } @@ -1976,7 +1957,7 @@ class LdapAdvanced @param array departments obtained from LDAP/Active Directory @param array of departments, first call have only top level departments - */ + */ public function getRegisteredDepartments(array $arrayLdapDepartment, array $arrayDbDepartment) { $aResult = array(); @@ -2019,9 +2000,9 @@ class LdapAdvanced } /** - select departments but it is not recursive, only returns departments in this level - @param string $DepParent the DEP_UID for parent department - */ + select departments but it is not recursive, only returns departments in this level + @param string $DepParent the DEP_UID for parent department + */ public function getDepartments($DepParent) { try { @@ -2037,13 +2018,13 @@ class LdapAdvanced foreach ($objects as $oDepartment) { $node = array(); - $node['DEP_UID'] = $oDepartment->getDepUid(); - $node['DEP_PARENT'] = $oDepartment->getDepParent(); - $node['DEP_TITLE'] = stripslashes($oDepartment->getDepTitle()); - $node['DEP_STATUS'] = $oDepartment->getDepStatus(); - $node['DEP_MANAGER'] = $oDepartment->getDepManager(); - $node['DEP_LDAP_DN'] = $oDepartment->getDepLdapDn(); - $node['DEP_LAST'] = 0; + $node['DEP_UID'] = $oDepartment->getDepUid(); + $node['DEP_PARENT'] = $oDepartment->getDepParent(); + $node['DEP_TITLE'] = stripslashes($oDepartment->getDepTitle()); + $node['DEP_STATUS'] = $oDepartment->getDepStatus(); + $node['DEP_MANAGER'] = $oDepartment->getDepManager(); + $node['DEP_LDAP_DN'] = $oDepartment->getDepLdapDn(); + $node['DEP_LAST'] = 0; $criteriaCount = new Criteria('workflow'); $criteriaCount->clearSelectColumns(); @@ -2057,7 +2038,7 @@ class LdapAdvanced } if (count($result) >= 1) { - $result[ count($result) -1 ]['DEP_LAST'] = 1; + $result[count($result) - 1]['DEP_LAST'] = 1; } return $result; @@ -2072,7 +2053,7 @@ class LdapAdvanced @param string department UID ( DEP_UID value ) @return array of users - */ + */ public function getUserFromPM($username) { try { @@ -2103,12 +2084,12 @@ class LdapAdvanced @param array authSource row, in this fuction we are validating if Removed OU is defined or not @return array of users - */ + */ public function getUsersFromRemovedOu($aAuthSource) { $aUsers = array(); //empty array is the default result $attributes = $aAuthSource["AUTH_SOURCE_DATA"]; - $this->sTerminatedOu = isset($attributes['AUTH_SOURCE_RETIRED_OU'])? trim($attributes['AUTH_SOURCE_RETIRED_OU']) : ''; + $this->sTerminatedOu = isset($attributes['AUTH_SOURCE_RETIRED_OU']) ? trim($attributes['AUTH_SOURCE_RETIRED_OU']) : ''; if ($this->sTerminatedOu == '') { return $aUsers; @@ -2124,11 +2105,11 @@ class LdapAdvanced @param array authSource row, in this fuction we are validating if Removed OU is defined or not @return array of users - */ + */ public function deactiveArrayOfUsers($aUsers) { if (!class_exists('RbacUsers')) { - require_once(PATH_RBAC.'model/RbacUsers.php'); + require_once(PATH_RBAC . 'model/RbacUsers.php'); } if (!class_exists('Users')) { @@ -2173,7 +2154,7 @@ class LdapAdvanced @param array $aUser info taken from ldap @param string $depUid the department UID @return boolean - */ + */ public function createUserAndActivate($aUser, $depUid) { $rbac = &RBAC::getSingleton(); @@ -2190,34 +2171,34 @@ class LdapAdvanced $rbac->usersRolesObj = new UsersRoles(); } - $sUsername = $aUser['sUsername']; - $sFullname = $aUser['sFullname']; + $sUsername = $aUser['sUsername']; + $sFullname = $aUser['sFullname']; $sFirstname = $aUser['sFirstname']; - $sLastname = $aUser['sLastname']; - $sEmail = $aUser['sEmail']; - $sDn = $aUser['sDN']; + $sLastname = $aUser['sLastname']; + $sEmail = $aUser['sEmail']; + $sDn = $aUser['sDN']; $aData = array(); - $aData['USR_USERNAME'] = $sUsername; - $aData["USR_PASSWORD"] = "00000000000000000000000000000000"; - $aData['USR_FIRSTNAME'] = $sFirstname; - $aData['USR_LASTNAME'] = $sLastname; - $aData['USR_EMAIL'] = $sEmail; - $aData['USR_DUE_DATE'] = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 2)); - $aData['USR_CREATE_DATE'] = date('Y-m-d H:i:s'); - $aData['USR_UPDATE_DATE'] = date('Y-m-d H:i:s'); - $aData['USR_BIRTHDAY'] = date('Y-m-d'); - $aData['USR_STATUS'] = 1; - $aData['USR_AUTH_TYPE'] = 'ldapadvanced'; - $aData['UID_AUTH_SOURCE'] = $this->sAuthSource; + $aData['USR_USERNAME'] = $sUsername; + $aData["USR_PASSWORD"] = "00000000000000000000000000000000"; + $aData['USR_FIRSTNAME'] = $sFirstname; + $aData['USR_LASTNAME'] = $sLastname; + $aData['USR_EMAIL'] = $sEmail; + $aData['USR_DUE_DATE'] = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 2)); + $aData['USR_CREATE_DATE'] = date('Y-m-d H:i:s'); + $aData['USR_UPDATE_DATE'] = date('Y-m-d H:i:s'); + $aData['USR_BIRTHDAY'] = date('Y-m-d'); + $aData['USR_STATUS'] = 1; + $aData['USR_AUTH_TYPE'] = 'ldapadvanced'; + $aData['UID_AUTH_SOURCE'] = $this->sAuthSource; $aData['USR_AUTH_USER_DN'] = $sDn; $sUserUID = $rbac->createUser($aData, "PROCESSMAKER_OPERATOR"); - $aData['USR_STATUS'] = 'ACTIVE'; - $aData['USR_UID'] = $sUserUID; - $aData['DEP_UID'] = $depUid; - $aData['USR_ROLE'] = 'PROCESSMAKER_OPERATOR'; + $aData['USR_STATUS'] = 'ACTIVE'; + $aData['USR_UID'] = $sUserUID; + $aData['DEP_UID'] = $depUid; + $aData['USR_ROLE'] = 'PROCESSMAKER_OPERATOR'; require_once 'classes/model/Users.php'; @@ -2322,8 +2303,8 @@ class LdapAdvanced if (isset($arrayEntryData['cn']) && !is_array($arrayEntryData['cn'])) { $arrayGroup[] = [ - 'dn' => $arrayEntryData['dn'], - 'cn' => trim($arrayEntryData['cn']), + 'dn' => $arrayEntryData['dn'], + 'cn' => trim($arrayEntryData['cn']), 'users' => 0, ]; } @@ -2343,7 +2324,7 @@ class LdapAdvanced $str .= ' ' . $group['cn']; } - $this->log($ldapcnn, 'found '. count($arrayGroup) . ' groups: ' . $str); + $this->log($ldapcnn, 'found ' . count($arrayGroup) . ' groups: ' . $str); //Return return $arrayGroup; @@ -2357,7 +2338,6 @@ class LdapAdvanced * @param $currentDN * @return */ - public function getGrpUidIfExistsDN($currentDN) { try { @@ -2415,8 +2395,8 @@ class LdapAdvanced } /** - select groups but it is not recursive, only returns groups in this level - */ + select groups but it is not recursive, only returns groups in this level + */ public function getGroups() { try { @@ -2427,10 +2407,10 @@ class LdapAdvanced foreach ($objects as $oGroup) { $node = array(); - $node['GRP_UID'] = $oGroup->getGrpUid(); - $node['GRP_TITLE'] = stripslashes($oGroup->getGrpTitle()); - $node['GRP_STATUS'] = $oGroup->getGrpStatus(); - $node['GRP_LDAP_DN'] = $oGroup->getGrpLdapDn(); + $node['GRP_UID'] = $oGroup->getGrpUid(); + $node['GRP_TITLE'] = stripslashes($oGroup->getGrpTitle()); + $node['GRP_STATUS'] = $oGroup->getGrpStatus(); + $node['GRP_LDAP_DN'] = $oGroup->getGrpLdapDn(); $result[] = $node; } @@ -2450,7 +2430,7 @@ class LdapAdvanced @param array groups obtained from LDAP/Active Directory @param array of groups, first call have only top level groups - */ + */ public function getRegisteredGroups(array $arrayLdapGroup, array $arrayDbGroup) { $aResult = array(); @@ -2478,12 +2458,12 @@ class LdapAdvanced public function convertDateADtoPM($dateAD) { $unixTimestamp = ($dateAD / 10000000) - 11644560000; - $datePM = date('Y-m-d', mktime(0, 0, 0, date('m'), '01', date('Y') + 2));//(date('Y') + 10)."-12-01"; - if ($unixTimestamp >0) { + $datePM = date('Y-m-d', mktime(0, 0, 0, date('m'), '01', date('Y') + 2)); //(date('Y') + 10)."-12-01"; + if ($unixTimestamp > 0) { $dateAux = date("Y-m-d", $unixTimestamp); $yearAux = date("Y", $unixTimestamp); if (strlen(trim($yearAux)) <= 4) { - $datePM = $dateAux; + $datePM = $dateAux; } } return $datePM; @@ -2531,7 +2511,7 @@ class LdapAdvanced $userUid = $arrayUserData["USR_UID"]; $found = true; - $arrayData["already"]++; + $arrayData["already"] ++; $arrayData["alreadyUsers"] .= $arrayUserData["USR_USERNAME"] . " "; } @@ -2539,7 +2519,6 @@ class LdapAdvanced //If user DO NOT exists in this department.. do: //If exists with another AuthSource -> impossible //If exists in another department, but in PM and for this authsource, we need to move it - //$arrayNewUserData = $this->searchUserByUid($arrayUserLdap["sUsername"]); $arrayNewUserData = $arrayUserLdap; @@ -2560,7 +2539,7 @@ class LdapAdvanced $this->activateUser($arrayUserData["USR_UID"], $arrayNewUserData["sDN"], $departmentUid); - $arrayData["moved"]++; + $arrayData["moved"] ++; $arrayData["movedUsers"] .= $arrayUserData["USR_USERNAME"] . " "; $this->setArrayAuthenticationSourceUser($userUid, $arrayNewUserData); //INITIALIZE DATA //Update User @@ -2572,14 +2551,14 @@ class LdapAdvanced //Impossible $userUid = $arrayUserData["USR_UID"]; - $arrayData["impossible"]++; + $arrayData["impossible"] ++; $arrayData["impossibleUsers"] .= $arrayUserData["USR_USERNAME"] . " "; } else { //User not exists //Create User $userUid = $this->createUserAndActivate($arrayNewUserData, $departmentUid); - $arrayData["created"]++; + $arrayData["created"] ++; $arrayData["createdUsers"] .= $arrayNewUserData["sUsername"] . " "; $this->setArrayAuthenticationSourceUser($userUid, $arrayNewUserData); //INITIALIZE DATA //Add User @@ -2638,7 +2617,7 @@ class LdapAdvanced $userUid = $arrayUserData["USR_UID"]; $found = true; - $arrayData["already"]++; + $arrayData["already"] ++; $arrayData["alreadyUsers"] .= $arrayUserData["USR_USERNAME"] . " "; } @@ -2646,7 +2625,6 @@ class LdapAdvanced //If user DO NOT exists in this group.. do: //If exists with another AuthSource -> impossible //If exists in another group, but in PM and for this authsource, we need to move it - //$arrayNewUserData = $this->searchUserByUid($arrayUserLdap["sUsername"]); $arrayNewUserData = $arrayUserLdap; @@ -2661,7 +2639,7 @@ class LdapAdvanced $group->addUserToGroup($groupUid, $userUid); - $arrayData["moved"]++; + $arrayData["moved"] ++; $arrayData["movedUsers"] .= $arrayUserData["USR_USERNAME"] . " "; $this->setArrayAuthenticationSourceUser($userUid, $arrayNewUserData); //INITIALIZE DATA //Update User @@ -2673,7 +2651,7 @@ class LdapAdvanced //Impossible $userUid = $arrayUserData["USR_UID"]; - $arrayData["impossible"]++; + $arrayData["impossible"] ++; $arrayData["impossibleUsers"] .= $arrayUserData["USR_USERNAME"] . " "; } else { //User not exists @@ -2682,7 +2660,7 @@ class LdapAdvanced $group->addUserToGroup($groupUid, $userUid); - $arrayData["created"]++; + $arrayData["created"] ++; $arrayData["createdUsers"] .= $arrayNewUserData["sUsername"] . " "; $this->setArrayAuthenticationSourceUser($userUid, $arrayNewUserData); //INITIALIZE DATA //Add User @@ -2738,13 +2716,13 @@ class LdapAdvanced $arrayAttributesToSync = [ //Default attributes to sync 'USR_FIRSTNAME' => 'givenname', - 'USR_LASTNAME' => 'sn', - 'USR_EMAIL' => 'mail', - 'USR_STATUS' => 'useraccountcontrol' + 'USR_LASTNAME' => 'sn', + 'USR_EMAIL' => 'mail', + 'USR_STATUS' => 'useraccountcontrol' ]; if (isset($arrayAuthSourceData['AUTH_SOURCE_DATA']['AUTH_SOURCE_GRID_ATTRIBUTE']) && - !empty($arrayAuthSourceData['AUTH_SOURCE_DATA']['AUTH_SOURCE_GRID_ATTRIBUTE']) + !empty($arrayAuthSourceData['AUTH_SOURCE_DATA']['AUTH_SOURCE_GRID_ATTRIBUTE']) ) { foreach ($arrayAuthSourceData['AUTH_SOURCE_DATA']['AUTH_SOURCE_GRID_ATTRIBUTE'] as $value) { $arrayAttributesToSync[$value['attributeUser']] = $value['attributeLdap']; @@ -2752,8 +2730,8 @@ class LdapAdvanced } //Search User from LDAP Server - $uidUserIdentifier = (isset($arrayAuthSourceData['AUTH_SOURCE_DATA']['AUTH_SOURCE_IDENTIFIER_FOR_USER']))? - $arrayAuthSourceData['AUTH_SOURCE_DATA']['AUTH_SOURCE_IDENTIFIER_FOR_USER'] : 'uid'; + $uidUserIdentifier = (isset($arrayAuthSourceData['AUTH_SOURCE_DATA']['AUTH_SOURCE_IDENTIFIER_FOR_USER'])) ? + $arrayAuthSourceData['AUTH_SOURCE_DATA']['AUTH_SOURCE_IDENTIFIER_FOR_USER'] : 'uid'; $arrayAttribute = array_merge($this->arrayAttributesForUser, array_values($arrayAttributesToSync)); @@ -2767,10 +2745,10 @@ class LdapAdvanced $arrayUserLdap = $this->ldapGetAttributes($ldapcnn, $entry); - $username = (isset($arrayUserLdap[$uidUserIdentifier]))? $arrayUserLdap[$uidUserIdentifier] : ''; + $username = (isset($arrayUserLdap[$uidUserIdentifier])) ? $arrayUserLdap[$uidUserIdentifier] : ''; if ((is_array($username) && !empty($username)) || trim($username) != '') { - $username = trim((is_array($username))? $username[0] : $username); + $username = trim((is_array($username)) ? $username[0] : $username); if (isset($arrayUser[$username])) { if (!isset($this->arrayUserUpdateChecked[$username])) { @@ -2783,12 +2761,12 @@ class LdapAdvanced $attributeName = strtolower($value); if (isset($arrayUserLdap[$attributeName])) { - $ldapAttributeValue = trim((is_array($arrayUserLdap[$attributeName]))? $arrayUserLdap[$attributeName][0] : $arrayUserLdap[$attributeName]); + $ldapAttributeValue = trim((is_array($arrayUserLdap[$attributeName])) ? $arrayUserLdap[$attributeName][0] : $arrayUserLdap[$attributeName]); switch ($fieldName) { case 'USR_STATUS': if ($attributeName == 'useraccountcontrol') { - $ldapAttributeValue = (preg_match('/^(?:' . '512|544|66048|66080' . ')$/', $ldapAttributeValue))? (($arrayUser[$username][$fieldName] == 'VACATION')? 'VACATION' : 'ACTIVE') : 'INACTIVE'; + $ldapAttributeValue = (preg_match('/^(?:' . '512|544|66048|66080' . ')$/', $ldapAttributeValue)) ? (($arrayUser[$username][$fieldName] == 'VACATION') ? 'VACATION' : 'ACTIVE') : 'INACTIVE'; } break; case 'USR_DUE_DATE': @@ -2815,8 +2793,7 @@ class LdapAdvanced } } else { $this->log( - $ldapcnn, - 'User is repeated: Username "' . $username .'", DN "' . $arrayUserLdap['dn'] . '"' + $ldapcnn, 'User is repeated: Username "' . $username . '", DN "' . $arrayUserLdap['dn'] . '"' ); } @@ -2845,12 +2822,9 @@ class LdapAdvanced * @return array */ private function __ldapUsersUpdateData( - $ldapcnn, - array $arrayAuthSourceData, - $filterUsers, - array $arrayUserUid, - array $arrayData - ) { + $ldapcnn, array $arrayAuthSourceData, $filterUsers, array $arrayUserUid, array $arrayData + ) + { try { $totalUser = $arrayData['totalUser']; $countUser = $arrayData['countUser']; @@ -2887,15 +2861,14 @@ class LdapAdvanced do { if ($this->__ldapUserUpdateByDnAndData( - $ldapcnn, $arrayAuthSourceData, ldap_get_dn($ldapcnn, $entry), $arrayUser - ) + $ldapcnn, $arrayAuthSourceData, ldap_get_dn($ldapcnn, $entry), $arrayUser + ) ) { $countUser++; //Progress bar $this->frontEndShow( - 'BAR', - 'Update Users data: ' . $countUser . '/' . $totalUser . ' ' . $this->progressBar($totalUser, $countUser) + 'BAR', 'Update Users data: ' . $countUser . '/' . $totalUser . ' ' . $this->progressBar($totalUser, $countUser) ); } } while ($entry = ldap_next_entry($ldapcnn, $entry)); @@ -2939,7 +2912,7 @@ class LdapAdvanced $limit = $this->__getPageSizeLimitByData($arrayAuthenticationSourceData); $count = 0; - $uidUserIdentifier = (isset($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["AUTH_SOURCE_IDENTIFIER_FOR_USER"]))? $arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["AUTH_SOURCE_IDENTIFIER_FOR_USER"] : "uid"; + $uidUserIdentifier = (isset($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["AUTH_SOURCE_IDENTIFIER_FOR_USER"])) ? $arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["AUTH_SOURCE_IDENTIFIER_FOR_USER"] : "uid"; $filterUsers = ""; $arrayUserUid = array(); @@ -2954,7 +2927,7 @@ class LdapAdvanced if ($count == $limit) { list($totalUser, $countUser) = $this->__ldapUsersUpdateData( - $ldapcnn, $arrayAuthenticationSourceData, $filterUsers, $arrayUserUid, ['totalUser' => $totalUser, 'countUser' => $countUser] + $ldapcnn, $arrayAuthenticationSourceData, $filterUsers, $arrayUserUid, ['totalUser' => $totalUser, 'countUser' => $countUser] ); $count = 0; @@ -2966,7 +2939,7 @@ class LdapAdvanced if ($count > 0) { list($totalUser, $countUser) = $this->__ldapUsersUpdateData( - $ldapcnn, $arrayAuthenticationSourceData, $filterUsers, $arrayUserUid, ['totalUser' => $totalUser, 'countUser' => $countUser] + $ldapcnn, $arrayAuthenticationSourceData, $filterUsers, $arrayUserUid, ['totalUser' => $totalUser, 'countUser' => $countUser] ); } } catch (Exception $e) { @@ -3013,7 +2986,7 @@ class LdapAdvanced $countEntries = ldap_count_entries($ldapcnn, $searchResult); if ($countEntries > 0) { - $limit = ($countEntries > $limit)? $limit : $countEntries; + $limit = ($countEntries > $limit) ? $limit : $countEntries; } } From dad676acc7603290b00186820daf3e262007bffc Mon Sep 17 00:00:00 2001 From: alex Date: Wed, 13 Sep 2017 16:08:20 -0400 Subject: [PATCH 08/85] FBI-1288: DB connection dropdown is not completely displayed --- workflow/engine/templates/pmTables/editReport.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/workflow/engine/templates/pmTables/editReport.js b/workflow/engine/templates/pmTables/editReport.js index ea249268e..ad419faf9 100644 --- a/workflow/engine/templates/pmTables/editReport.js +++ b/workflow/engine/templates/pmTables/editReport.js @@ -1036,14 +1036,18 @@ function validateFieldSizeAutoincrement(valueType, defaultValue) { bodyStyle:'padding:10px', waitMsgTarget : true, frame: true, - height: _plugin_permissions !== false ? 224 : 200, defaults: { allowBlank: false, msgTarget: 'side', align:'center' }, + listeners: { + afterRender: function () { + this.setHeight('auto'); + } + }, items: items - } + }; var frmDetails = new Ext.FormPanel(frmDetailsConfig); From 0df3a018c47988f70e1c201c6234133b21eb4d9c Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Wed, 13 Sep 2017 16:35:35 -0400 Subject: [PATCH 09/85] HOR-3221 observations --- workflow/engine/classes/LdapAdvanced.php | 68 ++++-------------------- 1 file changed, 11 insertions(+), 57 deletions(-) diff --git a/workflow/engine/classes/LdapAdvanced.php b/workflow/engine/classes/LdapAdvanced.php index b251b488c..1602cb583 100644 --- a/workflow/engine/classes/LdapAdvanced.php +++ b/workflow/engine/classes/LdapAdvanced.php @@ -1,5 +1,7 @@ folder, but it was deprecated * and now we are saving the log in shared/log the entry in the log file. - * @author Fernando Ontiveros Lira + * * @param Object $_link ldap connection * @param String $text */ @@ -496,7 +497,7 @@ class LdapAdvanced /** * This method generates the ldap connection bind and returns the link object * for a determined authsource - * @author Fernando Ontiveros Lira + * * @param Array $aAuthSource the authsource data * @return Object A object with the resulting ldap bind */ @@ -541,7 +542,7 @@ class LdapAdvanced /** * This method obtains the attributes of a ldap Connection passed as parameter * @param Object $ldapcnn ldap connection - * @author Fernando Ontiveros Lira + * * @param Object $oEntry Entry object * @return Array attributes */ @@ -799,9 +800,7 @@ class LdapAdvanced * * @return array Return array data */ - private function __ldapGroupSynchronizeMembers( - $ldapcnn, array $arrayAuthSourceData, $groupUid, array $arrayGroupLdap, $memberAttribute, array $arrayData = [] - ) + private function __ldapGroupSynchronizeMembers($ldapcnn, array $arrayAuthSourceData, $groupUid, array $arrayGroupLdap, $memberAttribute, array $arrayData = []) { try { unset($arrayData['countMembers']); @@ -1006,7 +1005,7 @@ class LdapAdvanced * This method authentifies if a user has the RBAC_user privileges * also verifies if the user has the rights to start an application * - * @author Fernando Ontiveros Lira + * * @access public * @param string $strUser UserId (user login) @@ -1092,7 +1091,7 @@ class LdapAdvanced $userDn = $verifiedUser['sDN']; //Update data - $user = new \ProcessMaker\BusinessModel\User(); + $user = new User(); $arrayUserData = $user->getUserRecordByPk($usrUid, [], false); $result = $this->__ldapUserUpdateByDnAndData( @@ -1377,18 +1376,8 @@ class LdapAdvanced } while (($oEntry = ldap_next_entry($ldapcnn, $oEntry)) && $flagNextRecord); } } - /* - $sUsers = "found $countEntries users: "; - - foreach ($aUsers as $key => $val) { - $sUsers .= $val['sUsername'] . ' '; - } - - $this->log($ldapcnn, $sUsers); - */ } - //Return return ($paged) ? array("numRecTotal" => $totalUser, "data" => $arrayUser) : $arrayUser; } @@ -1406,7 +1395,6 @@ class LdapAdvanced //Set variables $rbac = &RBAC::getSingleton(); - //$rbac->userObj = new RbacUsers(); if (is_null($rbac->authSourcesObj)) { $rbac->authSourcesObj = new AuthenticationSource(); @@ -1505,7 +1493,6 @@ class LdapAdvanced } } - //Return return $arrayUserData; } catch (Exception $e) { throw $e; @@ -1697,7 +1684,6 @@ class LdapAdvanced $this->log($ldapcnn, 'found ' . count($arrayDepartment) . ' departments: ' . $str); - //Return return $arrayDepartment; } catch (Exception $e) { throw $e; @@ -1715,7 +1701,7 @@ class LdapAdvanced $aUsers = array(); $rbac = &RBAC::getSingleton(); - //$rbac->userObj = new RbacUsers(); + $rbac->authSourcesObj = new AuthenticationSource(); $aAuthSource = $rbac->authSourcesObj->load($this->sAuthSource); @@ -1739,7 +1725,6 @@ class LdapAdvanced $aAttr = $this->ldapGetAttributes($ldapcnn, $oEntry); $aUsers[] = $this->ldapGetUsersFromDepartment("GET", $aAttr["dn"]); } while ($oEntry = ldap_next_entry($ldapcnn, $oEntry)); - //$this->createDepartments ($aDepts); } } return $aUsers; @@ -1802,7 +1787,6 @@ class LdapAdvanced $arrayData[$row["DEP_UID"]] = $row["NUM_REC"]; } - //Return return $arrayData; } catch (Exception $e) { throw $e; @@ -1966,31 +1950,10 @@ class LdapAdvanced $arrayLdapDepartment[0]["ou"] = $arrayLdapDepartment[0]["ou"] . " " . $arrayLdapDepartment[0]["dn"]; //Discard ROOT foreach ($arrayLdapDepartment as $ldapDept) { - //$flagExists = false; - // - //foreach ($aResult as $value2) { - // $arrayDepartmentData = $value2; - // - // if ($arrayDepartmentData["DEP_LDAP_DN"] == $ldapDept["dn"]) { - // $flagExists = true; - // break; - // } - //} - // - //if ($flagExists) { - // continue; - //} - foreach ($arrayDbDepartment as $department) { if ($department["DEP_TITLE"] == $ldapDept["ou"] && $department["DEP_LDAP_DN"] == $ldapDept["dn"]) { $aResult[] = $department; break; - - //if ($department["HAS_CHILDREN"] != 0) { - // $aTempDepartments = $this->getDepartments($department["DEP_UID"]); - // $aTempRegistered = $this->getRegisteredDepartments($arrayLdapDepartment, $aTempDepartments); - // $aResult = array_merge($aResult, $aTempRegistered); - //} } } } @@ -2326,7 +2289,6 @@ class LdapAdvanced $this->log($ldapcnn, 'found ' . count($arrayGroup) . ' groups: ' . $str); - //Return return $arrayGroup; } catch (Exception $e) { throw $e; @@ -2387,7 +2349,6 @@ class LdapAdvanced $arrayData[$row["GRP_UID"]] = $row["NUM_REC"]; } - //Return return $arrayData; } catch (Exception $e) { throw $e; @@ -2451,14 +2412,13 @@ class LdapAdvanced /** * Convert 18-digit LDAP timestamps to format PM * - * @author Ronald Escobar * @param Date | $dateAD | Date of AD ('Windows NT time format' and 'Win32 FILETIME or SYSTEMTIME') * @param Date | $datePM | Date of PM */ public function convertDateADtoPM($dateAD) { $unixTimestamp = ($dateAD / 10000000) - 11644560000; - $datePM = date('Y-m-d', mktime(0, 0, 0, date('m'), '01', date('Y') + 2)); //(date('Y') + 10)."-12-01"; + $datePM = date('Y-m-d', mktime(0, 0, 0, date('m'), '01', date('Y') + 2)); if ($unixTimestamp > 0) { $dateAux = date("Y-m-d", $unixTimestamp); $yearAux = date("Y", $unixTimestamp); @@ -2582,7 +2542,6 @@ class LdapAdvanced $this->debugLog("class.ldapAdvanced.php > function departmentSynchronizeUser() > \$userUid ----> $userUid"); $this->debugLog("class.ldapAdvanced.php > function departmentSynchronizeUser() > END"); - //Return return $arrayData; } catch (Exception $e) { throw $e; @@ -2821,9 +2780,7 @@ class LdapAdvanced * * @return array */ - private function __ldapUsersUpdateData( - $ldapcnn, array $arrayAuthSourceData, $filterUsers, array $arrayUserUid, array $arrayData - ) + private function __ldapUsersUpdateData($ldapcnn, array $arrayAuthSourceData, $filterUsers, array $arrayUserUid, array $arrayData) { try { $totalUser = $arrayData['totalUser']; @@ -2844,7 +2801,6 @@ class LdapAdvanced $criteria = new Criteria('workflow'); $criteria->add(UsersPeer::USR_UID, $arrayUserUid, Criteria::IN); - //$criteria->add(UsersPeer::USR_USERNAME, '', Criteria::NOT_EQUAL); $criteria->add(UsersPeer::USR_STATUS, 'CLOSED', Criteria::NOT_EQUAL); $rsCriteria = UsersPeer::doSelectRS($criteria); @@ -2875,7 +2831,6 @@ class LdapAdvanced } } - //Return return [$totalUser, $countUser]; } catch (Exception $e) { throw $e; @@ -2990,7 +2945,6 @@ class LdapAdvanced } } - //Return return $limit; } catch (Exception $e) { throw $e; From 2e46e670c77de50e341bb3510d2222d23c130568 Mon Sep 17 00:00:00 2001 From: hjonathan Date: Tue, 12 Sep 2017 08:28:55 -0400 Subject: [PATCH 10/85] bugfix/HOR-3556 udpate update update update update update update change function to static update update --- workflow/engine/classes/Cases.php | 17 +++++++++++++---- workflow/engine/classes/WsBase.php | 2 +- workflow/engine/classes/model/AppNotes.php | 18 +++++++++++++++++- workflow/engine/controllers/appProxy.php | 14 ++++++-------- workflow/engine/controllers/home.php | 4 +++- 5 files changed, 40 insertions(+), 15 deletions(-) diff --git a/workflow/engine/classes/Cases.php b/workflow/engine/classes/Cases.php index 1576d8249..df5b01b34 100644 --- a/workflow/engine/classes/Cases.php +++ b/workflow/engine/classes/Cases.php @@ -6969,11 +6969,20 @@ class Cases return $response; } + /** + * This method return the cases notes + * @param $applicationID + * @param string $type + * @param string $userUid + * @return array|stdclass|string + */ public function getCaseNotes($applicationID, $type = 'array', $userUid = '') { require_once("classes/model/AppNotes.php"); $appNotes = new AppNotes(); $appNotes = $appNotes->getNotesList($applicationID, $userUid); + $appNotes = AppNotes::applyHtmlentitiesInNotes($appNotes); + $response = ''; if (is_array($appNotes)) { switch ($type) { @@ -7005,10 +7014,10 @@ class Cases $response = ''; foreach ($appNotes['array']['notes'] as $key => $value) { $response .= $value['USR_FIRSTNAME'] . " " . - $value['USR_LASTNAME'] . " " . - "(" . $value['USR_USERNAME'] . ")" . - " " . $value['NOTE_CONTENT'] . " " . " (" . $value['NOTE_DATE'] . " ) " . - " \n"; + $value['USR_LASTNAME'] . " " . + "(" . $value['USR_USERNAME'] . ")" . + " " . $value['NOTE_CONTENT'] . " " . " (" . $value['NOTE_DATE'] . " ) " . + " \n"; } break; } diff --git a/workflow/engine/classes/WsBase.php b/workflow/engine/classes/WsBase.php index 6455e8f68..4040fb5da 100644 --- a/workflow/engine/classes/WsBase.php +++ b/workflow/engine/classes/WsBase.php @@ -2788,7 +2788,7 @@ class WsBase public function getCaseNotes($applicationID, $userUid = '') { try { - $result = new wsGetCaseNotesResponse(0, G::loadTranslation('ID_SUCCESS'), Cases::getCaseNotes($applicationID, 'array', $userUid)); + $result = new WsGetCaseNotesResponse(0, G::loadTranslation('ID_SUCCESS'), Cases::getCaseNotes($applicationID, 'array', $userUid)); $var = array(); diff --git a/workflow/engine/classes/model/AppNotes.php b/workflow/engine/classes/model/AppNotes.php index 736173b36..d508b3258 100644 --- a/workflow/engine/classes/model/AppNotes.php +++ b/workflow/engine/classes/model/AppNotes.php @@ -83,7 +83,7 @@ class AppNotes extends BaseAppNotes $oDataset->next(); while ($aRow = $oDataset->getRow()) { - $aRow['NOTE_CONTENT'] = htmlentities(stripslashes($aRow['NOTE_CONTENT']), ENT_QUOTES, 'UTF-8'); + $aRow['NOTE_CONTENT'] = stripslashes($aRow['NOTE_CONTENT']); $response['notes'][] = $aRow; $oDataset->next(); } @@ -240,5 +240,21 @@ class AppNotes extends BaseAppNotes return $response; } + + /** + * Add htmlEntities to notes in node_content + * @param $notes + * @return array + */ + public static function applyHtmlentitiesInNotes($notes) + { + if (isset($notes) && isset($notes["array"])) { + foreach ($notes["array"]["notes"] as &$note) { + $note["NOTE_CONTENT"] = htmlentities($note["NOTE_CONTENT"], ENT_QUOTES, 'UTF-8'); + } + } + return $notes; + } + } diff --git a/workflow/engine/controllers/appProxy.php b/workflow/engine/controllers/appProxy.php index b62a725fe..b54ca5502 100644 --- a/workflow/engine/controllers/appProxy.php +++ b/workflow/engine/controllers/appProxy.php @@ -73,14 +73,11 @@ class AppProxy extends HttpProxyController $proUid = $httpData->pro; } - if(!isset($httpData->tas) || empty($httpData->tas)) - { - $tasUid = $_SESSION['TASK']; + if (!isset($httpData->tas) || empty($httpData->tas)) { + $tasUid = isset($_SESSION['TASK']) ? $_SESSION['TASK'] : ""; } else { $tasUid = $httpData->tas; } - //$proUid = (!isset($httpData->pro)) ? $_SESSION['PROCESS'] : $httpData->pro; - //$tasUid = (!isset($httpData->tas)) ? ((isset($_SESSION['TASK'])) ? $_SESSION['TASK'] : '') : $httpData->tas; $usrUid = $_SESSION['USER_LOGGED']; $respView = $case->getAllObjectsFrom($proUid, $appUid, $tasUid, $usrUid, "VIEW", $delIndex); @@ -91,11 +88,12 @@ class AppProxy extends HttpProxyController ); } - $usrUid = isset( $_SESSION['USER_LOGGED'] ) ? $_SESSION['USER_LOGGED'] : ""; + $usrUid = isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : ""; $appNotes = new AppNotes(); - $response = $appNotes->getNotesList( $appUid, '', $httpData->start, $httpData->limit ); + $response = $appNotes->getNotesList($appUid, '', $httpData->start, $httpData->limit); + $response = AppNotes::applyHtmlentitiesInNotes($response); - require_once ("classes/model/Application.php"); + require_once("classes/model/Application.php"); $oApplication = new Application(); $aApplication = $oApplication->Load($appUid); $response['array']['appTitle'] = $aApplication['APP_TITLE']; diff --git a/workflow/engine/controllers/home.php b/workflow/engine/controllers/home.php index 8633d6982..c3e9d8ea7 100644 --- a/workflow/engine/controllers/home.php +++ b/workflow/engine/controllers/home.php @@ -544,7 +544,9 @@ class Home extends Controller $cases['data'][$i]['APP_DEL_PREVIOUS_USER'] = ucwords( $row['APP_DEL_PREVIOUS_USER'] ); } // Completting with Notes - $notes = $appNotes->getNotesList( $row['APP_UID'], '', $notesStart, $notesLimit ); + $notes = $appNotes->getNotesList($row['APP_UID'], '', $notesStart, $notesLimit); + $notes = AppNotes::applyHtmlentitiesInNotes($notes); + $notes = $notes['array']; $cases['data'][$i]['NOTES_COUNT'] = $notes['totalCount']; From 49fab7bd4ca791359f8f192849962b49d17b6001 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 15 Sep 2017 14:25:42 +0000 Subject: [PATCH 11/85] FBI-1025 --- workflow/engine/templates/processes/main.js | 22 +++++++++++++------- workflow/public_html/images/add_18.png | Bin 0 -> 767 bytes workflow/public_html/images/delete_16.png | Bin 0 -> 343 bytes workflow/public_html/images/pencil.png | Bin 0 -> 529 bytes 4 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 workflow/public_html/images/add_18.png create mode 100644 workflow/public_html/images/delete_16.png create mode 100644 workflow/public_html/images/pencil.png diff --git a/workflow/engine/templates/processes/main.js b/workflow/engine/templates/processes/main.js index 07f5a895f..54894af2b 100644 --- a/workflow/engine/templates/processes/main.js +++ b/workflow/engine/templates/processes/main.js @@ -322,7 +322,8 @@ Ext.onReady(function(){ newTypeProcess = { xtype: "tbsplit", text: _("ID_NEW"), - iconCls: "button_menu_ext ss_sprite ss_add", + iconCls: "button_menu_ext", + icon: "/images/add_18.png", menu: arrayMenuNewOption, listeners: { "click": function (obj, e) @@ -344,7 +345,8 @@ Ext.onReady(function(){ } newTypeProcess = { text: _("ID_NEW"), - iconCls: "button_menu_ext ss_sprite ss_add", + iconCls: "button_menu_ext", + icon: "/images/add_18.png", handler: handler }; } @@ -480,8 +482,8 @@ Ext.onReady(function(){ '-' ,{ text: _('ID_EDIT'), - iconCls: 'button_menu_ext ss_sprite ss_pencil', - //icon: '/images/edit.gif', + iconCls: 'button_menu_ext', + icon: '/images/pencil.png', handler: editProcess },/*{ text: 'Edit (New Editor)', @@ -497,7 +499,8 @@ Ext.onReady(function(){ disabled:true },{ text: _('ID_DELETE'), - iconCls: "button_menu_ext ss_sprite ss_cross", + iconCls: "button_menu_ext", + icon: "/images/delete_16.png", handler:deleteProcess },{ xtype: 'tbseparator' @@ -513,7 +516,8 @@ Ext.onReady(function(){ },{ id: 'deleteCasesId', text: _('ID_DELETE_CASES'), - iconCls: "button_menu_ext ss_sprite ss_cross", + iconCls: "button_menu_ext", + icon: "/images/delete_16.png", handler: deleteCases, hidden: true },{ @@ -702,7 +706,8 @@ Ext.onReady(function(){ var arrayContextMenuOption = [ { text: _("ID_EDIT"), - iconCls: "button_menu_ext ss_sprite ss_pencil", + iconCls: "button_menu_ext", + icon: "/images/pencil.png", handler: editProcess }, { @@ -718,7 +723,8 @@ Ext.onReady(function(){ }, { text: _("ID_DELETE"), - iconCls: "button_menu_ext ss_sprite ss_cross", + iconCls: "button_menu_ext", + icon: "/images/delete_16.png", handler: deleteProcess }, menuExportOption, diff --git a/workflow/public_html/images/add_18.png b/workflow/public_html/images/add_18.png new file mode 100644 index 0000000000000000000000000000000000000000..a02d0cbab405d6b47a04fb4bf8d944913851b4aa GIT binary patch literal 767 zcmVnT~eEMzOV+KT{rC8Hn?}zph?l7>cnM)X!DR~)7wya zr^L1}{KJ|+^lYrtz%qY6XSk+6om+*E?lDBd5eS8lmX-HIkONU!!sAO%_Z;DQlNkWeF=~R#zk$gwTk8{*1yhR8Sz8 zkc`OX@;OT~QZwM+*+R#s2MBwEczO3toCE;WDmC<(MOgJZKuoR#BEd9Zam=A8y%>s+ zpkhMS(Sv(PWLBV-RVd6X#)tVy2&RE#L}odvX`5S~)?YQ;!dK@ANG5cQnxHTMDA1`j zs5R7M#PS}2(Dphpn-d=L+t8w~srQ165SBo^isBaQXeXODU+KTJQ&CCZB;HPgDqu-|x+>W?O=5|ZBb?CpQ xZS1Wx3MP|?o0cG$J;dD4G7Va~m+aX0@f!o+W^J(T7b5@w002ovPDHLkV1lavt!`D;~NZsuCY%2mha# ze>KYO|HAqY&I&&Y{lB&5eu=X9-=6w^>*V)kvCsW=uci3j2)6vcq3>H)(f69Dzf+1n z`e=P^OSv55@xL!alX9-And*?6YhK&=$s$AirP+hi5m^K%69RcNc~Z zR#^`qhqJ&VvY3H^TNs2H8D`Cq01C2~c>21sKjh@+71dkLlA!?_z?A9rf@(@&*GuGN^d0?x=qoCJ~%-alQ}3Nu|AuR&Dq?^2BXEN6Pr_9?y`rzB?!9 ha#o9Q>Y?@1=Iv)^DB8ttdDLuZ!m{(IDKj{0Ga5;g_e$|{?*$Tp4{Rk;ppMI?y@$@^OM>=?o zRayTWz4--FDhLGOwl`@0>TUpO7b%I1+hkJP07%7kWot({L^HUIf5AN0 z_z_Lw^H-4ixkuxx&jLWPjT}#5{f(hjJw&9FT*NkL7?>A#rgjavIzlb$Aho>4>Fz$k z!KJ*rH|}V0Ea(Wi5t<#TwIa{nJ3{il_Ti_oSSu6)E(T1w~W=AAXk z#b4xAhC`k-f% Date: Fri, 15 Sep 2017 17:52:26 -0400 Subject: [PATCH 12/85] HOR-3185 --- workflow/engine/classes/PmDynaform.php | 30 +++++++++---------- .../src/ProcessMaker/BusinessModel/Cases.php | 1 + .../ProcessMaker/BusinessModel/Variable.php | 7 +++++ 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/workflow/engine/classes/PmDynaform.php b/workflow/engine/classes/PmDynaform.php index f36ee0bae..83bfbd01d 100644 --- a/workflow/engine/classes/PmDynaform.php +++ b/workflow/engine/classes/PmDynaform.php @@ -2,6 +2,7 @@ use ProcessMaker\Core\System; use ProcessMaker\BusinessModel\DynaForm\SuggestTrait; +use ProcessMaker\BusinessModel\Cases; /** * Implementing pmDynaform library in the running case. @@ -250,11 +251,6 @@ class PmDynaform $dtFields = $json->queryInputData; } else { $dtFields = $this->getValuesDependentFields($json); - foreach ($dtFields as $keyF => $valueF) { - if (isset($this->fields["APP_DATA"][$keyF])) { - $dtFields[$keyF] = $this->fields["APP_DATA"][$keyF]; - } - } } $sql = G::replaceDataField($json->sql, $dtFields); if ($value === "suggest") { @@ -610,7 +606,8 @@ class PmDynaform $json->dataGridEnvironment = "onDataGridEnvironment"; if (isset($this->fields["APP_DATA"])) { $dataGridEnvironment = $this->fields["APP_DATA"]; - $this->fields["APP_DATA"] = []; + //Grids only access the global variables of 'ProcessMaker', other variables are removed. + $this->fields["APP_DATA"] = Cases::getGlobalVariables($this->fields["APP_DATA"]); //restore AppData with dataVariable definition, only for columns control foreach ($columnsDataVariable as $dge) { if (isset($dataGridEnvironment[$dge])) { @@ -691,7 +688,14 @@ class PmDynaform if (!isset($this->record["DYN_CONTENT"])) { return array(); } - $data = array(); + $data = []; + if (isset($this->fields["APP_DATA"])) { + foreach ($this->fields["APP_DATA"] as $keyF => $valueF) { + if (!isset($data[$keyF]) && !is_array($valueF)) { + $data[$keyF] = $valueF; + } + } + } if (isset($json->dbConnection) && isset($json->sql)) { $result = array(); preg_match_all('/\@(?:([\@\%\#\=\!Qq])([a-zA-Z\_]\w*)|([a-zA-Z\_][\w\-\>\:]*)\(((?:[^\\\\\)]*?)*)\))/', $json->sql, $result, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE); @@ -708,18 +712,12 @@ class PmDynaform } } if ($json->dbConnection !== "" && $json->dbConnection !== "none" && $json->sql !== "") { - if (isset($this->fields["APP_DATA"])) { - foreach ($this->fields["APP_DATA"] as $keyA => $valueA) { - if (!isset($data[$keyA]) && !is_array($valueA)) { - $data[$keyA] = $valueA; - } - } - } $sql = G::replaceDataField($json->sql, $data); $dt = $this->getCacheQueryData($json->dbConnection, $sql, $json->type); $row = isset($dt[0]) ? $dt[0] : []; - if (isset($row[0]) && $json->type !== "suggest" && $json->type !== "radio") { - $data[$json->variable === "" ? $json->id : $json->variable] = $row[0]; + $index = $json->variable === "" ? $json->id : $json->variable; + if (!isset($data[$index]) && isset($row[0]) && $json->type !== "suggest" && $json->type !== "radio") { + $data[$index] = $row[0]; } } } diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php b/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php index a6ebcf7c9..dadae9167 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php @@ -1680,6 +1680,7 @@ class Cases if (!is_null($dynaFormUid)) { + $data["APP_DATA"] = $fields['APP_DATA']; $data["CURRENT_DYNAFORM"] = $dynaFormUid; $pmDynaForm = new PmDynaform($data); $arrayDynaFormData = $pmDynaForm->getDynaform(); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php b/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php index abc80d5ef..b547b8c9f 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php @@ -5,6 +5,7 @@ use G; use Exception; use AdditionalTables; use PmDynaform; +use ProcessMaker\BusinessModel\Cases; class Variable { @@ -778,6 +779,7 @@ class Variable $fields = $case->loadCase($appUid, $delIndex); $appData = $fields["APP_DATA"]; $appData = array_merge($appData, \ProcessMaker\BusinessModel\Cases::getGlobalVariables($appData)); + $paramsWithoutAppData = $params; $params = array_merge($appData, $params); } @@ -795,6 +797,11 @@ class Variable $field->queryFilter = $filter; $field->queryStart = $start; $field->queryLimit = $limit; + //Grids only access the global variables of 'ProcessMaker', other variables are removed. + if (isset($field->columnWidth)) { + $pmDynaform->fields["APP_DATA"] = Cases::getGlobalVariables($appData); + $field->queryInputData = $paramsWithoutAppData; + } //Populate control data $pmDynaform->jsonr($field); From aef7405764bad0428d65ac0577fda70dbb582074 Mon Sep 17 00:00:00 2001 From: hjonathan Date: Mon, 18 Sep 2017 14:44:47 -0400 Subject: [PATCH 13/85] HOR-3630 --- workflow/engine/methods/cases/caseMessageHistory_Ajax.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/workflow/engine/methods/cases/caseMessageHistory_Ajax.php b/workflow/engine/methods/cases/caseMessageHistory_Ajax.php index a43f9b0eb..8a9c4f268 100644 --- a/workflow/engine/methods/cases/caseMessageHistory_Ajax.php +++ b/workflow/engine/methods/cases/caseMessageHistory_Ajax.php @@ -101,8 +101,6 @@ if ($actionAjax == 'messageHistoryGridList_JXP') { if ($respMess == 'BLOCK' || $respMess == '') { $appMessageArray[$index]['APP_MSG_BODY'] = ""; } - $appMessageArray[$index]['APP_MSG_BODY'] = str_replace('\"','"',$appMessageArray[$index]['APP_MSG_BODY']); - $appMessageArray[$index]['APP_MSG_BODY'] = str_replace('"','\"',$appMessageArray[$index]['APP_MSG_BODY']); $aProcesses[] = array_merge($appMessageArray[$index], array('MSGS_HISTORY' => $respMess)); $totalCount ++; } From 381985824c79ffd5fc23091fb7a5cb6f08e472ed Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Mon, 18 Sep 2017 16:17:39 -0400 Subject: [PATCH 14/85] HOR-3182 --- gulliver/system/class.bootstrap.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/gulliver/system/class.bootstrap.php b/gulliver/system/class.bootstrap.php index e8ed3cd19..87a972836 100644 --- a/gulliver/system/class.bootstrap.php +++ b/gulliver/system/class.bootstrap.php @@ -2567,11 +2567,7 @@ class Bootstrap $hashType = Bootstrap::getPasswordHashType(); } - $filter = new InputFilter(); - $hashType = $filter->validateInput($hashType); - $pass = $filter->validateInput($pass); - - eval("\$var = hash('" . $hashType . "', '" . $pass . "');"); + $var = hash($hashType, $pass); if ($includeHashType) { $var = $hashType . ':' . $var; From 8a07af4461e43fc4f15e0429af4ddcb9b8ced1e9 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Tue, 19 Sep 2017 09:56:06 -0400 Subject: [PATCH 15/85] HOR-3185 improvement --- .../src/ProcessMaker/BusinessModel/Cases.php | 49 +++++++++++++------ .../ProcessMaker/BusinessModel/Variable.php | 2 +- 2 files changed, 36 insertions(+), 15 deletions(-) diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php b/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php index dadae9167..ba4f53e98 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php @@ -12,6 +12,7 @@ use WsBase; use RBAC; use Applications; use PmDynaform; +use ProcessMaker\Services\OAuth2\Server; class Cases { @@ -3245,26 +3246,46 @@ class Cases $appData = array_change_key_case($appData, CASE_UPPER); $dataVariable = array_change_key_case($dataVariable, CASE_UPPER); - if (!isset($dataVariable['APPLICATION']) || empty($dataVariable['APPLICATION'])) { - $dataVariable['APPLICATION'] = (isset($dataVariable['APP_UID']) && $dataVariable['APP_UID'] != '') ? $dataVariable['APP_UID'] : $appData['APPLICATION']; + $result = []; + //we get the appData parameters + if (!empty($appData['APPLICATION'])) { + $result['APPLICATION'] = $appData['APPLICATION']; } - if (!isset($dataVariable['PROCESS']) || empty($dataVariable['PROCESS'])) { - $dataVariable['PROCESS'] = (isset($dataVariable['PRO_UID']) && $dataVariable['PRO_UID'] != '') ? $dataVariable['PRO_UID'] : $appData['PROCESS']; + if (!empty($appData['PROCESS'])) { + $result['PROCESS'] = $appData['PROCESS']; } - if (isset($appData['TASK']) && !empty($appData['TASK'])) { - $dataVariable['TASK'] = $appData['TASK']; + if (!empty($appData['TASK'])) { + $result['TASK'] = $appData['TASK']; } - if (isset($appData['INDEX']) && !empty($appData['INDEX'])) { - $dataVariable['INDEX'] = $appData['INDEX']; + if (!empty($appData['INDEX'])) { + $result['INDEX'] = $appData['INDEX']; } - $dataVariable['USER_LOGGED'] = \ProcessMaker\Services\OAuth2\Server::getUserId(); - if (isset($dataVariable['USER_LOGGED']) && !empty($dataVariable['USER_LOGGED'])) { - $oUserLogged = new \Users(); - $oUserLogged->load($dataVariable['USER_LOGGED']); - $dataVariable['USR_USERNAME'] = $oUserLogged->getUsrUsername(); + if (!empty($appData['USER_LOGGED'])) { + $result['USER_LOGGED'] = $appData['USER_LOGGED']; + } + if (!empty($appData['USR_USERNAME'])) { + $result['USR_USERNAME'] = $appData['USR_USERNAME']; } - return $dataVariable; + //we try to get the missing elements + if (!empty($dataVariable['APP_UID']) && empty($result['APPLICATION'])) { + $result['APPLICATION'] = $dataVariable['APP_UID']; + } + if (!empty($dataVariable['PRO_UID']) && empty($result['PROCESS'])) { + $result['PROCESS'] = $dataVariable['PRO_UID']; + } + if (empty($result['USER_LOGGED'])) { + $result['USER_LOGGED'] = Server::getUserId(); + if (!empty($result['USER_LOGGED'])) { + $oUserLogged = new Users(); + $oUserLogged->load($dataVariable['USER_LOGGED']); + $result['USR_USERNAME'] = $oUserLogged->getUsrUsername(); + } + } + + //the parameter dataVariable may contain additional elements + $result = array_merge($dataVariable, $result); + return $result; } /** diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php b/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php index b547b8c9f..d5103bd84 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php @@ -778,7 +778,7 @@ class Variable $case = new \Cases(); $fields = $case->loadCase($appUid, $delIndex); $appData = $fields["APP_DATA"]; - $appData = array_merge($appData, \ProcessMaker\BusinessModel\Cases::getGlobalVariables($appData)); + $appData = array_merge($appData, Cases::getGlobalVariables($appData)); $paramsWithoutAppData = $params; $params = array_merge($appData, $params); } From 59fc56265ac65c24a5dff8aea284a158261da36f Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Tue, 19 Sep 2017 11:19:45 -0400 Subject: [PATCH 16/85] HOR-3221 improvement --- gulliver/system/class.rbac.php | 31 +- workflow/engine/classes/LdapAdvanced.php | 2 +- .../engine/methods/services/ldapadvanced.php | 566 ++++++++---------- 3 files changed, 281 insertions(+), 318 deletions(-) diff --git a/gulliver/system/class.rbac.php b/gulliver/system/class.rbac.php index 5bb5d5713..905af017c 100644 --- a/gulliver/system/class.rbac.php +++ b/gulliver/system/class.rbac.php @@ -435,25 +435,32 @@ class RBAC foreach ($this->aRbacPlugins as $sClassName) { $plugin = new $sClassName(); - if (method_exists( $plugin, 'automaticRegister' )) { - $oCriteria = new Criteria( 'rbac' ); - $oCriteria->add( AuthenticationSourcePeer::AUTH_SOURCE_PROVIDER, $sClassName ); - $oCriteria->addAscendingOrderByColumn( AuthenticationSourcePeer::AUTH_SOURCE_NAME ); - $oDataset = AuthenticationSourcePeer::doSelectRS( $oCriteria, Propel::getDbConnection('rbac_ro') ); - $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + if (method_exists($plugin, 'automaticRegister')) { + $oCriteria = new Criteria('rbac'); + $oCriteria->add(AuthenticationSourcePeer::AUTH_SOURCE_PROVIDER, $sClassName); + $oCriteria->addAscendingOrderByColumn(AuthenticationSourcePeer::AUTH_SOURCE_NAME); + $oDataset = AuthenticationSourcePeer::doSelectRS($oCriteria, Propel::getDbConnection('rbac_ro')); + $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); $aRow = $oDataset->getRow(); - while (is_array( $aRow )) { - $aRow = array_merge( $aRow, unserialize( $aRow['AUTH_SOURCE_DATA'] ) ); + while (is_array($aRow)) { + $aRow = array_merge($aRow, unserialize($aRow['AUTH_SOURCE_DATA'])); //Check if this authsource is enabled for AutoRegister, if not skip this if ($aRow['AUTH_SOURCE_AUTO_REGISTER'] == 1) { $plugin->sAuthSource = $aRow['AUTH_SOURCE_UID']; $plugin->sSystem = $this->sSystem; //search the usersRolesObj //create the users in ProcessMaker - $res = $plugin->automaticRegister( $aRow, $strUser, $strPass ); - if ($res == 1) { - return $res; + try { + $res = $plugin->automaticRegister($aRow, $strUser, $strPass); + if ($res == 1) { + return $res; + } + } catch (Exception $e) { + $context = Bootstrap::getDefaultContextLog(); + $context["action"] = "ldapSynchronize"; + $context["authSource"] = $aRow; + Bootstrap::registerMonolog("ldapSynchronize", 400, $e->getMessage(), $context, $context["workspace"], "processmaker.log"); } } $oDataset->next(); @@ -461,7 +468,7 @@ class RBAC } } } - + return $result; } /** diff --git a/workflow/engine/classes/LdapAdvanced.php b/workflow/engine/classes/LdapAdvanced.php index 1602cb583..f25a38caf 100644 --- a/workflow/engine/classes/LdapAdvanced.php +++ b/workflow/engine/classes/LdapAdvanced.php @@ -1180,7 +1180,7 @@ class LdapAdvanced } if ($validUserPass == 1) { - $this->log($ldapcnn, "sucessful login user " . $verifiedUser["sDN"]); + $this->log($ldapcnn, "sucessful login user " . $userDn); } else { $this->log($ldapcnn, "failure authentication for user $strUser"); } diff --git a/workflow/engine/methods/services/ldapadvanced.php b/workflow/engine/methods/services/ldapadvanced.php index a37594dd4..a51e376cd 100644 --- a/workflow/engine/methods/services/ldapadvanced.php +++ b/workflow/engine/methods/services/ldapadvanced.php @@ -71,352 +71,308 @@ class ldapadvancedClassCron foreach ($arrayAuthenticationSource as $value) { $arrayAuthenticationSourceData = $value; + try { + $plugin->debugLog("ldapadvanced.php > function executeCron() > foreach > \$arrayAuthenticationSourceData ---->\n" . print_r($arrayAuthenticationSourceData, true)); - $plugin->debugLog("ldapadvanced.php > function executeCron() > foreach > \$arrayAuthenticationSourceData ---->\n" . print_r($arrayAuthenticationSourceData, true)); + $plugin->sAuthSource = $arrayAuthenticationSourceData["AUTH_SOURCE_UID"]; + $plugin->ldapcnn = null; - $plugin->sAuthSource = $arrayAuthenticationSourceData["AUTH_SOURCE_UID"]; - $plugin->ldapcnn = null; + $plugin->setArrayDepartmentUserSynchronizedChecked(array()); + $plugin->setArrayUserUpdateChecked(array()); - $plugin->setArrayDepartmentUserSynchronizedChecked(array()); - $plugin->setArrayUserUpdateChecked(array()); + //Get all User (USR_UID, USR_USERNAME, USR_AUTH_USER_DN) registered in RBAC with this Authentication Source + $plugin->setArrayAuthenticationSourceUsers($arrayAuthenticationSourceData["AUTH_SOURCE_UID"]); //INITIALIZE DATA - //Get all User (USR_UID, USR_USERNAME, USR_AUTH_USER_DN) registered in RBAC with this Authentication Source - $plugin->setArrayAuthenticationSourceUsers($arrayAuthenticationSourceData["AUTH_SOURCE_UID"]); //INITIALIZE DATA + $plugin->frontEndShow("TEXT", "Authentication Source: " . $arrayAuthenticationSourceData["AUTH_SOURCE_NAME"]); - $plugin->frontEndShow("TEXT", "Authentication Source: " . $arrayAuthenticationSourceData["AUTH_SOURCE_NAME"]); + $plugin->log(null, "Executing cron for Authentication Source: " . $arrayAuthenticationSourceData["AUTH_SOURCE_NAME"]); - $plugin->log(null, "Executing cron for Authentication Source: " . $arrayAuthenticationSourceData["AUTH_SOURCE_NAME"]); + //Get all departments from Ldap/ActiveDirectory and build a hierarchy using dn (ou->ou parent) + $aLdapDepts = $plugin->searchDepartments(); - //Get all departments from Ldap/ActiveDirectory and build a hierarchy using dn (ou->ou parent) - $aLdapDepts = $plugin->searchDepartments(); + //Obtain all departments from PM with a valid department in LDAP/ActiveDirectory + $aRegisteredDepts = $plugin->getRegisteredDepartments($aLdapDepts, $aDepartments); - //Obtain all departments from PM with a valid department in LDAP/ActiveDirectory - $aRegisteredDepts = $plugin->getRegisteredDepartments($aLdapDepts, $aDepartments); + $plugin->debugLog("ldapadvanced.php > function executeCron() > foreach > \$aRegisteredDepts ---->\n" . print_r($aRegisteredDepts, true)); - $plugin->debugLog("ldapadvanced.php > function executeCron() > foreach > \$aRegisteredDepts ---->\n" . print_r($aRegisteredDepts, true)); + //Get all group from Ldap/ActiveDirectory + $aLdapGroups = $plugin->searchGroups(); - //Get all group from Ldap/ActiveDirectory - $aLdapGroups = $plugin->searchGroups(); + //Obtain all groups from PM with a valid group in LDAP/ActiveDirectory + $aRegisteredGroups = $plugin->getRegisteredGroups($aLdapGroups, $aGroups); - //Obtain all groups from PM with a valid group in LDAP/ActiveDirectory - $aRegisteredGroups = $plugin->getRegisteredGroups($aLdapGroups, $aGroups); + $plugin->debugLog("ldapadvanced.php > function executeCron() > foreach > \$aRegisteredGroups ---->\n" . print_r($aRegisteredGroups, true)); - $plugin->debugLog("ldapadvanced.php > function executeCron() > foreach > \$aRegisteredGroups ---->\n" . print_r($aRegisteredGroups, true)); + //Get all users from Removed OU + $this->usersRemovedOu = $plugin->getUsersFromRemovedOu($arrayAuthenticationSourceData); + $plugin->deactiveArrayOfUsers($this->usersRemovedOu); - //Get all users from Removed OU - $this->usersRemovedOu = $plugin->getUsersFromRemovedOu($arrayAuthenticationSourceData); - $plugin->deactiveArrayOfUsers($this->usersRemovedOu); + //Variables + $this->deletedRemoved = count($this->usersRemovedOu); + $this->deletedRemovedUsers = ""; - //Variables - $this->deletedRemoved = count($this->usersRemovedOu); - $this->deletedRemovedUsers = ""; + $this->dAlready = 0; + $this->dMoved = 0; + $this->dImpossible = 0; + $this->dCreated = 0; + $this->dRemoved = 0; + $this->dAlreadyUsers = ""; + $this->dMovedUsers = ""; + $this->dImpossibleUsers = ""; + $this->dCreatedUsers = ""; + $this->dRemovedUsers = ""; - $this->dAlready = 0; - $this->dMoved = 0; - $this->dImpossible = 0; - $this->dCreated = 0; - $this->dRemoved = 0; - $this->dAlreadyUsers = ""; - $this->dMovedUsers = ""; - $this->dImpossibleUsers = ""; - $this->dCreatedUsers = ""; - $this->dRemovedUsers = ""; + $this->gAlready = 0; + $this->gMoved = 0; + $this->gImpossible = 0; + $this->gCreated = 0; + $this->gRemoved = 0; + $this->gAlreadyUsers = ""; + $this->gMovedUsers = ""; + $this->gImpossibleUsers = ""; + $this->gCreatedUsers = ""; + $this->gRemovedUsers = ""; - $this->gAlready = 0; - $this->gMoved = 0; - $this->gImpossible = 0; - $this->gCreated = 0; - $this->gRemoved = 0; - $this->gAlreadyUsers = ""; - $this->gMovedUsers = ""; - $this->gImpossibleUsers = ""; - $this->gCreatedUsers = ""; - $this->gRemovedUsers = ""; + //Department - Synchronize Users + $numDepartments = count($aRegisteredDepts); + $count = 0; - //Department - Synchronize Users - $numDepartments = count($aRegisteredDepts); - $count = 0; + $plugin->debugLog("ldapadvanced.php > function executeCron() > foreach > \$numDepartments ----> $numDepartments"); - $plugin->debugLog("ldapadvanced.php > function executeCron() > foreach > \$numDepartments ----> $numDepartments"); - - foreach ($aRegisteredDepts as $registeredDept) { - $count++; - - //(D) Update Users - //if (!isset($arrayDepartmentUserAd[$registeredDept["DEP_UID"]])) { - // $arrayDepartmentUserAd[$registeredDept["DEP_UID"]] = array(); //Current users in department based in Active Directory - //} - // - //$arrayAux = $this->departmentSynchronizeUsers($plugin, $numDepartments, $count, $registeredDept); - //$arrayAux = array_merge($arrayDepartmentUserAd[$registeredDept["DEP_UID"]], $arrayAux); - // - //$arrayDepartmentUserAd[$registeredDept["DEP_UID"]] = array_unique($arrayAux); - - $arrayAux = $this->departmentSynchronizeUsers($plugin, $numDepartments, $count, $registeredDept); - } - - //Department - Print log - $logResults = sprintf( - "- Departments -> Existing users: %d, moved: %d, impossible: %d, created: %d, removed: %d", - $this->dAlready, - $this->dMoved, - $this->dImpossible, - $this->dCreated, - $this->dRemoved - ); - - $plugin->frontEndShow("TEXT", $logResults); - - $plugin->log(null, $logResults); - - //Group - Synchronize Users - $numGroups = count($aRegisteredGroups); - $count = 0; - - $plugin->debugLog("ldapadvanced.php > function executeCron() > foreach > \$numGroups ----> $numGroups"); - - foreach ($aRegisteredGroups as $registeredGroup) { - $count++; - - //(G) Update Users - //if (!isset($arrayGroupUserAd[$registeredGroup["GRP_UID"]])) { - // $arrayGroupUserAd[$registeredGroup["GRP_UID"]] = array(); //Current users in group based in Active Directory - //} - // - //$arrayAux = $this->groupSynchronizeUsers($plugin, $numGroups, $count, $registeredGroup); - //$arrayAux = array_merge($arrayGroupUserAd[$registeredGroup["GRP_UID"]], $arrayAux); - // - //$arrayGroupUserAd[$registeredGroup["GRP_UID"]] = array_unique($arrayAux); - - $arrayAux = $this->groupSynchronizeUsers($plugin, $numGroups, $count, $registeredGroup); - } - - //Group - Print log - $logResults = sprintf( - "- Groups -> Existing users: %d, moved: %d, impossible: %d, created: %d, removed: %d", - $this->gAlready, - $this->gMoved, - $this->gImpossible, - $this->gCreated, - $this->gRemoved - ); - - $plugin->frontEndShow("TEXT", $logResults); - - $plugin->log(null, $logResults); - - //Manager - $plugin->clearManager($this->managersToClear); - - if (isset($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["DEPARTMENTS_TO_UNASSIGN"])) { - if (is_array($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["DEPARTMENTS_TO_UNASSIGN"])) { - foreach ($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["DEPARTMENTS_TO_UNASSIGN"] as $departmentUID) { - // Delete manager assignments - $criteriaSet = new Criteria("workflow"); - $criteriaSet->add(UsersPeer::USR_REPORTS_TO, ""); - $criteriaWhere = new Criteria("workflow"); - $criteriaWhere->add(UsersPeer::DEP_UID, $departmentUID); - $criteriaWhere->add(UsersPeer::USR_REPORTS_TO, "", Criteria::NOT_EQUAL); - $this->deletedManager = BasePeer::doUpdate($criteriaWhere, $criteriaSet, Propel::getConnection("workflow")); - // Delete department assignments - $criteriaSet = new Criteria("workflow"); - $criteriaSet->add(UsersPeer::DEP_UID, ""); - $criteriaWhere = new Criteria("workflow"); - $criteriaWhere->add(UsersPeer::DEP_UID, $departmentUID); - $this->dMoved += UsersPeer::doCount($criteriaWhere); - BasePeer::doUpdate($criteriaWhere, $criteriaSet, Propel::getConnection("workflow")); - } + foreach ($aRegisteredDepts as $registeredDept) { + $count++; + $arrayAux = $this->departmentSynchronizeUsers($plugin, $numDepartments, $count, $registeredDept); } - unset($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["DEPARTMENTS_TO_UNASSIGN"]); + //Department - Print log + $logResults = sprintf( + "- Departments -> Existing users: %d, moved: %d, impossible: %d, created: %d, removed: %d", + $this->dAlready, + $this->dMoved, + $this->dImpossible, + $this->dCreated, + $this->dRemoved + ); - $rbac = &RBAC::getSingleton(); - $rbac->authSourcesObj->update($arrayAuthenticationSourceData); - } + $plugin->frontEndShow("TEXT", $logResults); - if (isset($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["GROUPS_TO_UNASSIGN"])) { - if (is_array($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["GROUPS_TO_UNASSIGN"])) { - foreach ($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["GROUPS_TO_UNASSIGN"] as $groupUID) { - // Delete manager assignments - $groupsInstance = new Groups(); - $criteria = $groupsInstance->getUsersGroupCriteria($groupUID); - $dataset = UsersPeer::doSelectRS($criteria); - $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $dataset->next(); - $users = array(); + $plugin->log(null, $logResults); - while ($row = $dataset->getRow()) { - $users[] = $row["USR_UID"]; + //Group - Synchronize Users + $numGroups = count($aRegisteredGroups); + $count = 0; + + $plugin->debugLog("ldapadvanced.php > function executeCron() > foreach > \$numGroups ----> $numGroups"); + + foreach ($aRegisteredGroups as $registeredGroup) { + $count++; + $arrayAux = $this->groupSynchronizeUsers($plugin, $numGroups, $count, $registeredGroup); + } + + //Group - Print log + $logResults = sprintf( + "- Groups -> Existing users: %d, moved: %d, impossible: %d, created: %d, removed: %d", + $this->gAlready, + $this->gMoved, + $this->gImpossible, + $this->gCreated, + $this->gRemoved + ); + + $plugin->frontEndShow("TEXT", $logResults); + + $plugin->log(null, $logResults); + + //Manager + $plugin->clearManager($this->managersToClear); + + if (isset($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["DEPARTMENTS_TO_UNASSIGN"])) { + if (is_array($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["DEPARTMENTS_TO_UNASSIGN"])) { + foreach ($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["DEPARTMENTS_TO_UNASSIGN"] as $departmentUID) { + // Delete manager assignments + $criteriaSet = new Criteria("workflow"); + $criteriaSet->add(UsersPeer::USR_REPORTS_TO, ""); + $criteriaWhere = new Criteria("workflow"); + $criteriaWhere->add(UsersPeer::DEP_UID, $departmentUID); + $criteriaWhere->add(UsersPeer::USR_REPORTS_TO, "", Criteria::NOT_EQUAL); + $this->deletedManager = BasePeer::doUpdate($criteriaWhere, $criteriaSet, Propel::getConnection("workflow")); + // Delete department assignments + $criteriaSet = new Criteria("workflow"); + $criteriaSet->add(UsersPeer::DEP_UID, ""); + $criteriaWhere = new Criteria("workflow"); + $criteriaWhere->add(UsersPeer::DEP_UID, $departmentUID); + $this->dMoved += UsersPeer::doCount($criteriaWhere); + BasePeer::doUpdate($criteriaWhere, $criteriaSet, Propel::getConnection("workflow")); + } + } + + unset($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["DEPARTMENTS_TO_UNASSIGN"]); + + $rbac = &RBAC::getSingleton(); + $rbac->authSourcesObj->update($arrayAuthenticationSourceData); + } + + if (isset($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["GROUPS_TO_UNASSIGN"])) { + if (is_array($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["GROUPS_TO_UNASSIGN"])) { + foreach ($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["GROUPS_TO_UNASSIGN"] as $groupUID) { + // Delete manager assignments + $groupsInstance = new Groups(); + $criteria = $groupsInstance->getUsersGroupCriteria($groupUID); + $dataset = UsersPeer::doSelectRS($criteria); + $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $dataset->next(); - } + $users = array(); - $criteriaSet = new Criteria("workflow"); - $criteriaSet->add(UsersPeer::USR_REPORTS_TO, ""); - $criteriaWhere = new Criteria("workflow"); - $criteriaWhere->add(UsersPeer::USR_UID, $users, Criteria::IN); - $criteriaWhere->add(UsersPeer::USR_REPORTS_TO, "", Criteria::NOT_EQUAL); - $this->deletedManager = BasePeer::doUpdate($criteriaWhere, $criteriaSet, Propel::getConnection("workflow")); - - // Delete group assignments - $criteria = new Criteria("workflow"); - $criteria->add(GroupUserPeer::GRP_UID, $groupUID); - $this->gMoved += GroupUserPeer::doCount($criteria); - BasePeer::doDelete($criteria, Propel::getConnection("workflow")); - } - } - - unset($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["GROUPS_TO_UNASSIGN"]); - - $rbac = &RBAC::getSingleton(); - $rbac->authSourcesObj->update($arrayAuthenticationSourceData); - } - - // Delete the managers that not exists in PM - $criteria = new Criteria("rbac"); - $criteria->addSelectColumn(RbacUsersPeer::USR_AUTH_USER_DN); - $criteria->add(RbacUsersPeer::USR_AUTH_USER_DN, "", Criteria::NOT_EQUAL); - $dataset = RbacUsersPeer::doSelectRS($criteria); - $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $dataset->next(); - $existingUsers = array(); - - while ($row = $dataset->getRow()) { - $existingUsers[] = $row["USR_AUTH_USER_DN"]; - $dataset->next(); - } - - foreach ($this->managersHierarchy as $managerDN => $subordinates) { - if (!in_array($managerDN, $existingUsers)) { - unset($this->managersHierarchy[$managerDN]); - } - } - - // Get the managers assigments counters - $plugin->synchronizeManagers($this->managersHierarchy); - - $deletedManagersAssignments = self::array_diff_assoc_recursive($this->oldManagersHierarchy, $this->managersHierarchy); - $newManagersAssignments = self::array_diff_assoc_recursive($this->managersHierarchy, $this->oldManagersHierarchy); - $deletedManagers = array(); - $newManagers = array(); - $movedManagers = array(); - - if (is_array($deletedManagersAssignments)) { - foreach ($deletedManagersAssignments as $dn1 => $subordinates1) { - foreach ($subordinates1 as $subordinate) { - if (!in_array($subordinate, $deletedManagers)) { - $deletedManagers[] = $subordinate; - } - - foreach ($newManagersAssignments as $dn2 => $subordinates2) { - if (isset($subordinates2[$subordinate])) { - $movedManagers[] = $subordinate; + while ($row = $dataset->getRow()) { + $users[] = $row["USR_UID"]; + $dataset->next(); } + + $criteriaSet = new Criteria("workflow"); + $criteriaSet->add(UsersPeer::USR_REPORTS_TO, ""); + $criteriaWhere = new Criteria("workflow"); + $criteriaWhere->add(UsersPeer::USR_UID, $users, Criteria::IN); + $criteriaWhere->add(UsersPeer::USR_REPORTS_TO, "", Criteria::NOT_EQUAL); + $this->deletedManager = BasePeer::doUpdate($criteriaWhere, $criteriaSet, Propel::getConnection("workflow")); + + // Delete group assignments + $criteria = new Criteria("workflow"); + $criteria->add(GroupUserPeer::GRP_UID, $groupUID); + $this->gMoved += GroupUserPeer::doCount($criteria); + BasePeer::doDelete($criteria, Propel::getConnection("workflow")); } } + + unset($arrayAuthenticationSourceData["AUTH_SOURCE_DATA"]["GROUPS_TO_UNASSIGN"]); + + $rbac = &RBAC::getSingleton(); + $rbac->authSourcesObj->update($arrayAuthenticationSourceData); } - } - if (is_array($newManagersAssignments)) { - foreach ($newManagersAssignments as $dn1 => $subordinates1) { - foreach ($subordinates1 as $subordinate) { - if (!in_array($subordinate, $newManagers)) { - $newManagers[] = $subordinate; - } + // Delete the managers that not exists in PM + $criteria = new Criteria("rbac"); + $criteria->addSelectColumn(RbacUsersPeer::USR_AUTH_USER_DN); + $criteria->add(RbacUsersPeer::USR_AUTH_USER_DN, "", Criteria::NOT_EQUAL); + $dataset = RbacUsersPeer::doSelectRS($criteria); + $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $dataset->next(); + $existingUsers = array(); - foreach ($deletedManagersAssignments as $dn2 => $subordinates2) { - if (isset($subordinates2[$subordinate])) { - if (!in_array($subordinate, $movedManagers)) { + while ($row = $dataset->getRow()) { + $existingUsers[] = $row["USR_AUTH_USER_DN"]; + $dataset->next(); + } + + foreach ($this->managersHierarchy as $managerDN => $subordinates) { + if (!in_array($managerDN, $existingUsers)) { + unset($this->managersHierarchy[$managerDN]); + } + } + + // Get the managers assigments counters + $plugin->synchronizeManagers($this->managersHierarchy); + + $deletedManagersAssignments = self::array_diff_assoc_recursive($this->oldManagersHierarchy, $this->managersHierarchy); + $newManagersAssignments = self::array_diff_assoc_recursive($this->managersHierarchy, $this->oldManagersHierarchy); + $deletedManagers = array(); + $newManagers = array(); + $movedManagers = array(); + + if (is_array($deletedManagersAssignments)) { + foreach ($deletedManagersAssignments as $dn1 => $subordinates1) { + foreach ($subordinates1 as $subordinate) { + if (!in_array($subordinate, $deletedManagers)) { + $deletedManagers[] = $subordinate; + } + + foreach ($newManagersAssignments as $dn2 => $subordinates2) { + if (isset($subordinates2[$subordinate])) { $movedManagers[] = $subordinate; } } } } } + + if (is_array($newManagersAssignments)) { + foreach ($newManagersAssignments as $dn1 => $subordinates1) { + foreach ($subordinates1 as $subordinate) { + if (!in_array($subordinate, $newManagers)) { + $newManagers[] = $subordinate; + } + + foreach ($deletedManagersAssignments as $dn2 => $subordinates2) { + if (isset($subordinates2[$subordinate])) { + if (!in_array($subordinate, $movedManagers)) { + $movedManagers[] = $subordinate; + } + } + } + } + } + } + + //Print and log the users's information + //Deleted/Removed Users + $logResults = sprintf("- Deleted/Removed Users: %d", $this->deletedRemoved); + + $plugin->frontEndShow("TEXT", $logResults); + + $plugin->log(null, $logResults); + + if ($this->deletedRemoved > 0) { + $plugin->log(null, "Deleted/Removed Users: "); + $plugin->log(null, $this->deletedRemovedUsers); + } + + if ($this->dAlready + $this->gAlready > 0) { + $plugin->log(null, "Existing Users: "); + $plugin->log(null, $this->dAlreadyUsers . " " . $this->gAlreadyUsers); + } + + if ($this->dMoved + $this->gMoved > 0) { + $plugin->log(null, "Moved Users: "); + $plugin->log(null, $this->dMovedUsers . " " . $this->gMovedUsers); + } + + if ($this->dImpossible + $this->gImpossible > 0) { + $plugin->log(null, "Impossible Users: "); + $plugin->log(null, $this->dImpossibleUsers . " " . $this->gImpossibleUsers); + } + + if ($this->dCreated + $this->gCreated > 0) { + $plugin->log(null, "Created Users: "); + $plugin->log(null, $this->dCreatedUsers . " " . $this->gCreatedUsers); + } + + if ($this->dRemoved + $this->gRemoved > 0) { + $plugin->log(null, "Removed Users: "); + $plugin->log(null, $this->dRemovedUsers . " " . $this->gRemovedUsers); + } + + //Print and log the managers assignments"s information + $logResults = sprintf( + "- Managers assignments: created %d, moved %d, removed %d", + count($newManagers) - count($movedManagers), + count($movedManagers), + count($deletedManagers) - count($movedManagers) + $this->deletedManager + ); + + $plugin->frontEndShow("TEXT", $logResults); + + $plugin->log(null, $logResults); + + //Update Users data based on the LDAP Server + $plugin->usersUpdateData($arrayAuthenticationSourceData["AUTH_SOURCE_UID"]); + } catch (Exception $e) { + $context = Bootstrap::getDefaultContextLog(); + $context["action"] = "ldapSynchronize"; + $context["authSource"] = $arrayAuthenticationSourceData; + Bootstrap::registerMonolog("ldapSynchronize", 400, $e->getMessage(), $context, $context["workspace"], "processmaker.log"); } - - //Print and log the users's information - //Deleted/Removed Users - $logResults = sprintf("- Deleted/Removed Users: %d", $this->deletedRemoved); - - $plugin->frontEndShow("TEXT", $logResults); - - $plugin->log(null, $logResults); - - if ($this->deletedRemoved > 0) { - $plugin->log(null, "Deleted/Removed Users: "); - $plugin->log(null, $this->deletedRemovedUsers); - } - - if ($this->dAlready + $this->gAlready > 0) { - $plugin->log(null, "Existing Users: "); - $plugin->log(null, $this->dAlreadyUsers . " " . $this->gAlreadyUsers); - } - - if ($this->dMoved + $this->gMoved > 0) { - $plugin->log(null, "Moved Users: "); - $plugin->log(null, $this->dMovedUsers . " " . $this->gMovedUsers); - } - - if ($this->dImpossible + $this->gImpossible > 0) { - $plugin->log(null, "Impossible Users: "); - $plugin->log(null, $this->dImpossibleUsers . " " . $this->gImpossibleUsers); - } - - if ($this->dCreated + $this->gCreated > 0) { - $plugin->log(null, "Created Users: "); - $plugin->log(null, $this->dCreatedUsers . " " . $this->gCreatedUsers); - } - - if ($this->dRemoved + $this->gRemoved > 0) { - $plugin->log(null, "Removed Users: "); - $plugin->log(null, $this->dRemovedUsers . " " . $this->gRemovedUsers); - } - - //Print and log the managers assignments"s information - $logResults = sprintf( - "- Managers assignments: created %d, moved %d, removed %d", - count($newManagers) - count($movedManagers), - count($movedManagers), - count($deletedManagers) - count($movedManagers) + $this->deletedManager - ); - - $plugin->frontEndShow("TEXT", $logResults); - - $plugin->log(null, $logResults); - - //Update Users data based on the LDAP Server - $plugin->usersUpdateData($arrayAuthenticationSourceData["AUTH_SOURCE_UID"]); } $plugin->frontEndShow("END"); - - //(D) Update Users - ////Department //Upgrade users in departments - //foreach ($arrayDepartmentUserAd as $departmentUid => $arrayUserAd) { - // $plugin->setArrayDepartmentUsers($departmentUid); //INITIALIZE DATA - // - // $arrayAux = array_diff(array_keys($plugin->arrayDepartmentUsersByUid), $arrayUserAd); - // - // $this->departmentRemoveUsers($departmentUid, $arrayAux); - //} - - //(G) Update Users - ////Group //Upgrade users in groups - //foreach ($arrayGroupUserAd as $groupUid => $arrayUserAd) { - // $plugin->setArrayGroupUsers($groupUid); //INITIALIZE DATA - // - // $arrayAux = array_diff(array_keys($plugin->arrayGroupUsersByUid), $arrayUserAd); - // - // $this->groupRemoveUsers($groupUid, $arrayAux); - //} - - //// Developed by Gary and Ronald - //$usersInfo = $plugin->ASUpdateInfo(''); - //if (isset($usersInfo) && $usersInfo > 0) { - // $this->dMoved = $usersInfo; - //} - //// End Developed by Gary and Ronald - $plugin->debugLog("END"); } From 2765e3aeecbb5f299756cd31547a641fb3928658 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Tue, 19 Sep 2017 11:25:25 -0400 Subject: [PATCH 17/85] HOR-3221 improvement --- .../engine/methods/services/ldapadvanced.php | 57 +++++++++---------- 1 file changed, 26 insertions(+), 31 deletions(-) diff --git a/workflow/engine/methods/services/ldapadvanced.php b/workflow/engine/methods/services/ldapadvanced.php index a51e376cd..7275e82f5 100644 --- a/workflow/engine/methods/services/ldapadvanced.php +++ b/workflow/engine/methods/services/ldapadvanced.php @@ -60,11 +60,6 @@ class ldapadvancedClassCron $aDepartments = $plugin->getDepartments(""); $aGroups = $plugin->getGroups(); - //$arrayDepartmentUserAd = array(); //(D) Update Users - //$arrayGroupUserAd = array(); //(G) Update Users - - //echo "\n"; - $plugin->frontEndShow("START"); $plugin->debugLog("START"); @@ -111,27 +106,27 @@ class ldapadvancedClassCron $this->deletedRemoved = count($this->usersRemovedOu); $this->deletedRemovedUsers = ""; - $this->dAlready = 0; - $this->dMoved = 0; + $this->dAlready = 0; + $this->dMoved = 0; $this->dImpossible = 0; - $this->dCreated = 0; - $this->dRemoved = 0; - $this->dAlreadyUsers = ""; - $this->dMovedUsers = ""; + $this->dCreated = 0; + $this->dRemoved = 0; + $this->dAlreadyUsers = ""; + $this->dMovedUsers = ""; $this->dImpossibleUsers = ""; - $this->dCreatedUsers = ""; - $this->dRemovedUsers = ""; + $this->dCreatedUsers = ""; + $this->dRemovedUsers = ""; - $this->gAlready = 0; - $this->gMoved = 0; + $this->gAlready = 0; + $this->gMoved = 0; $this->gImpossible = 0; - $this->gCreated = 0; - $this->gRemoved = 0; - $this->gAlreadyUsers = ""; - $this->gMovedUsers = ""; + $this->gCreated = 0; + $this->gRemoved = 0; + $this->gAlreadyUsers = ""; + $this->gMovedUsers = ""; $this->gImpossibleUsers = ""; - $this->gCreatedUsers = ""; - $this->gRemovedUsers = ""; + $this->gCreatedUsers = ""; + $this->gRemovedUsers = ""; //Department - Synchronize Users $numDepartments = count($aRegisteredDepts); @@ -321,28 +316,28 @@ class ldapadvancedClassCron $plugin->log(null, $logResults); if ($this->deletedRemoved > 0) { - $plugin->log(null, "Deleted/Removed Users: "); - $plugin->log(null, $this->deletedRemovedUsers); + $plugin->log(null, "Deleted/Removed Users: "); + $plugin->log(null, $this->deletedRemovedUsers); } if ($this->dAlready + $this->gAlready > 0) { - $plugin->log(null, "Existing Users: "); - $plugin->log(null, $this->dAlreadyUsers . " " . $this->gAlreadyUsers); + $plugin->log(null, "Existing Users: "); + $plugin->log(null, $this->dAlreadyUsers . " " . $this->gAlreadyUsers); } if ($this->dMoved + $this->gMoved > 0) { - $plugin->log(null, "Moved Users: "); - $plugin->log(null, $this->dMovedUsers . " " . $this->gMovedUsers); + $plugin->log(null, "Moved Users: "); + $plugin->log(null, $this->dMovedUsers . " " . $this->gMovedUsers); } if ($this->dImpossible + $this->gImpossible > 0) { - $plugin->log(null, "Impossible Users: "); - $plugin->log(null, $this->dImpossibleUsers . " " . $this->gImpossibleUsers); + $plugin->log(null, "Impossible Users: "); + $plugin->log(null, $this->dImpossibleUsers . " " . $this->gImpossibleUsers); } if ($this->dCreated + $this->gCreated > 0) { - $plugin->log(null, "Created Users: "); - $plugin->log(null, $this->dCreatedUsers . " " . $this->gCreatedUsers); + $plugin->log(null, "Created Users: "); + $plugin->log(null, $this->dCreatedUsers . " " . $this->gCreatedUsers); } if ($this->dRemoved + $this->gRemoved > 0) { From 5ef5c28d38fb72a25103bdf205211433880c5e21 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Tue, 19 Sep 2017 11:35:52 -0400 Subject: [PATCH 18/85] HOR-3221 improvement --- workflow/engine/classes/LdapAdvanced.php | 1 + 1 file changed, 1 insertion(+) diff --git a/workflow/engine/classes/LdapAdvanced.php b/workflow/engine/classes/LdapAdvanced.php index f25a38caf..57a6fba15 100644 --- a/workflow/engine/classes/LdapAdvanced.php +++ b/workflow/engine/classes/LdapAdvanced.php @@ -448,6 +448,7 @@ class LdapAdvanced * * @param Object $_link ldap connection * @param String $text + * @return void */ public function log($link, $text) { From 37cc674010c59ba33f484031999f30deeee8f998 Mon Sep 17 00:00:00 2001 From: Paula Quispe Date: Mon, 18 Sep 2017 17:48:03 -0400 Subject: [PATCH 19/85] HOR-3508 --- gulliver/system/class.monologProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gulliver/system/class.monologProvider.php b/gulliver/system/class.monologProvider.php index 9840834cb..5bbb5b3b4 100644 --- a/gulliver/system/class.monologProvider.php +++ b/gulliver/system/class.monologProvider.php @@ -31,7 +31,7 @@ class MonologProvider public $numOfKeepFiles = 60; public $levelDebug = 100; public $bubble = true; - public $filePermission = 0775; + public $filePermission = 0666; public function __construct ($channel, $fileLog) { From 50b23ff793080e95b5a29ae0941da4bf7a045755 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Wed, 20 Sep 2017 10:27:38 -0400 Subject: [PATCH 20/85] HOR-3221 improvement --- .../src/ProcessMaker/BusinessModel/Cases.php | 19 +++++++++++-------- .../ProcessMaker/BusinessModel/Variable.php | 5 ++++- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php b/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php index ba4f53e98..938a61b01 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php @@ -13,6 +13,7 @@ use RBAC; use Applications; use PmDynaform; use ProcessMaker\Services\OAuth2\Server; +use Users; class Cases { @@ -1680,7 +1681,7 @@ class Cases $arrayCaseVariable = []; if (!is_null($dynaFormUid)) { - + $data = []; $data["APP_DATA"] = $fields['APP_DATA']; $data["CURRENT_DYNAFORM"] = $dynaFormUid; $pmDynaForm = new PmDynaform($data); @@ -3260,12 +3261,6 @@ class Cases if (!empty($appData['INDEX'])) { $result['INDEX'] = $appData['INDEX']; } - if (!empty($appData['USER_LOGGED'])) { - $result['USER_LOGGED'] = $appData['USER_LOGGED']; - } - if (!empty($appData['USR_USERNAME'])) { - $result['USR_USERNAME'] = $appData['USR_USERNAME']; - } //we try to get the missing elements if (!empty($dataVariable['APP_UID']) && empty($result['APPLICATION'])) { @@ -3274,11 +3269,19 @@ class Cases if (!empty($dataVariable['PRO_UID']) && empty($result['PROCESS'])) { $result['PROCESS'] = $dataVariable['PRO_UID']; } + + $result['USER_LOGGED'] = ''; + $result['USR_USERNAME'] = ''; + global $RBAC; + if (isset($RBAC) && isset($RBAC->aUserInfo)) { + $result['USER_LOGGED'] = $RBAC->aUserInfo['USER_INFO']['USR_UID']; + $result['USR_USERNAME'] = $RBAC->aUserInfo['USER_INFO']['USR_USERNAME']; + } if (empty($result['USER_LOGGED'])) { $result['USER_LOGGED'] = Server::getUserId(); if (!empty($result['USER_LOGGED'])) { $oUserLogged = new Users(); - $oUserLogged->load($dataVariable['USER_LOGGED']); + $oUserLogged->load($result['USER_LOGGED']); $result['USR_USERNAME'] = $oUserLogged->getUsrUsername(); } } diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php b/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php index d5103bd84..1f62a795a 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php @@ -774,12 +774,12 @@ class Variable unset($params["limit"]); //Get appData and system variables + $paramsWithoutAppData = $params; if ($appUid !== null) { $case = new \Cases(); $fields = $case->loadCase($appUid, $delIndex); $appData = $fields["APP_DATA"]; $appData = array_merge($appData, Cases::getGlobalVariables($appData)); - $paramsWithoutAppData = $params; $params = array_merge($appData, $params); } @@ -798,6 +798,9 @@ class Variable $field->queryStart = $start; $field->queryLimit = $limit; //Grids only access the global variables of 'ProcessMaker', other variables are removed. + //The property 'columnWidth' is only present in the controls of a grid, + //in the current change there is no specific property that indicates + //if the control is in the grid. if (isset($field->columnWidth)) { $pmDynaform->fields["APP_DATA"] = Cases::getGlobalVariables($appData); $field->queryInputData = $paramsWithoutAppData; From 48902febfedcb1b7e9ccfb68a71bf3c640b526a2 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Wed, 20 Sep 2017 15:42:42 -0400 Subject: [PATCH 21/85] HOR-3185 improvement --- workflow/engine/src/ProcessMaker/BusinessModel/Variable.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php b/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php index 1f62a795a..ce7ab42a6 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php @@ -775,11 +775,13 @@ class Variable //Get appData and system variables $paramsWithoutAppData = $params; + $globalVariables = []; if ($appUid !== null) { $case = new \Cases(); $fields = $case->loadCase($appUid, $delIndex); $appData = $fields["APP_DATA"]; - $appData = array_merge($appData, Cases::getGlobalVariables($appData)); + $globalVariables = Cases::getGlobalVariables($appData); + $appData = array_merge($appData, $globalVariables); $params = array_merge($appData, $params); } @@ -802,7 +804,7 @@ class Variable //in the current change there is no specific property that indicates //if the control is in the grid. if (isset($field->columnWidth)) { - $pmDynaform->fields["APP_DATA"] = Cases::getGlobalVariables($appData); + $pmDynaform->fields["APP_DATA"] = $globalVariables; $field->queryInputData = $paramsWithoutAppData; } From 3ff07e15b4d58cc7e22931d79e8eeadbe9cb5e7b Mon Sep 17 00:00:00 2001 From: Paula Quispe Date: Thu, 21 Sep 2017 13:40:29 -0400 Subject: [PATCH 22/85] HOR-3910 --- workflow/engine/classes/ReportTables.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/workflow/engine/classes/ReportTables.php b/workflow/engine/classes/ReportTables.php index 6f72c8a9a..fe424dad3 100644 --- a/workflow/engine/classes/ReportTables.php +++ b/workflow/engine/classes/ReportTables.php @@ -599,6 +599,16 @@ class ReportTables } $sQuery = substr($sQuery, 0, -1); $sQuery .= " WHERE APP_UID = '" . $sApplicationUid . "'"; + + //Only we will to executeQuery if we have additional field + if (count($aTableFields) > 0) { + try { + $rs = $stmt->executeQuery($sQuery); + } catch (Exception $e) { + Bootstrap::registerMonolog('sqlExecution', 400, 'Sql Execution', ['sql' => $sQuery,'error' => $e->getMessage()], SYS_SYS, 'processmaker.log'); + } + + } } else { $sQuery = 'INSERT INTO `' . $aRow['REP_TAB_NAME'] . '` ('; $sQuery .= '`APP_UID`,`APP_NUMBER`'; @@ -630,8 +640,13 @@ class ReportTables } } $sQuery .= ')'; + + try { + $rs = $stmt->executeQuery($sQuery); + } catch (Exception $e) { + Bootstrap::registerMonolog('sqlExecution', 400, 'Sql Execution', ['sql' => $sQuery,'error' => $e->getMessage()], SYS_SYS, 'processmaker.log'); + } } - $rs = $stmt->executeQuery($sQuery); } else { //remove old rows from database $sqlDelete = 'DELETE FROM `' . $aRow['REP_TAB_NAME'] . "` WHERE APP_UID = '" . $sApplicationUid . "'"; From ab672f93fbc395d0ad8ce5a09c729e68b460cec4 Mon Sep 17 00:00:00 2001 From: hjonathan Date: Thu, 21 Sep 2017 13:57:11 -0400 Subject: [PATCH 23/85] HOR-3543 update update --- workflow/engine/menus/caseOptions.php | 24 ++++++++--- workflow/engine/methods/cases/open.php | 56 +++++++++++++------------- 2 files changed, 47 insertions(+), 33 deletions(-) diff --git a/workflow/engine/menus/caseOptions.php b/workflow/engine/menus/caseOptions.php index 5f93fb1c8..1c3016f2c 100644 --- a/workflow/engine/menus/caseOptions.php +++ b/workflow/engine/menus/caseOptions.php @@ -25,6 +25,8 @@ global $G_TMP_MENU; global $sStatus; global $RBAC; + +$viewSteps = true; $statusSendAndUnassigned = false; //caseOptions @@ -40,12 +42,9 @@ switch ($_SESSION['actionCaseOptions']) { $statusSendAndUnassigned = true; break; case 'paused': - if (isset($_SESSION['bNoShowSteps'])) { - unset($_SESSION['bNoShowSteps']); - } + $viewSteps = false; break; case 'to_revise': - case 'to_reassign': $access = $RBAC->requirePermissions('PM_REASSIGNCASE', 'PM_SUPERVISOR'); if ($access) { if (isset($_SESSION['bNoShowSteps'])) { @@ -53,8 +52,21 @@ switch ($_SESSION['actionCaseOptions']) { } } break; + case 'to_reassign': + $access = $RBAC->requirePermissions('PM_REASSIGNCASE', 'PM_SUPERVISOR'); + if ($access) { + $aData = AppDelegation::getCurrentUsers($_SESSION['APPLICATION'], $_SESSION['INDEX']); + if (isset($aData) && !in_array($_SESSION['USER_LOGGED'], $aData)) { + $viewSteps = false; + } + } + break; default: + $aData = AppDelegation::getCurrentUsers($_SESSION['APPLICATION'], $_SESSION['INDEX']); unset($_SESSION['bNoShowSteps']); + if (isset($aData) && !in_array($_SESSION['USER_LOGGED'], $aData)) { + $viewSteps = false; + } break; } @@ -64,7 +76,9 @@ if ((($sStatus === 'DRAFT') || ($sStatus === 'TO_DO')) && !$statusSendAndUnassig if (isset($_SESSION['bNoShowSteps'])) { unset($_SESSION['bNoShowSteps']); } else { - $G_TMP_MENU->AddIdOption('STEPS', G::LoadTranslation('ID_STEPS'), 'javascript:showSteps();', 'absolute'); + if ($viewSteps === true) { + $G_TMP_MENU->AddIdOption('STEPS', G::LoadTranslation('ID_STEPS'), 'javascript:showSteps();', 'absolute'); + } $G_TMP_MENU->AddIdOption('INFO', G::LoadTranslation('ID_INFORMATION'), 'javascript:showInformation();', 'absolute'); } $G_TMP_MENU->AddIdOption('ACTIONS', G::LoadTranslation('ID_ACTIONS'), 'javascript:showActions();', 'absolute'); diff --git a/workflow/engine/methods/cases/open.php b/workflow/engine/methods/cases/open.php index ab2b7259c..178854640 100644 --- a/workflow/engine/methods/cases/open.php +++ b/workflow/engine/methods/cases/open.php @@ -29,7 +29,7 @@ */ $tBarGmail = false; -if(isset( $_GET['gmail']) && $_GET['gmail'] == 1){ +if (isset($_GET['gmail']) && $_GET['gmail'] == 1) { $_SESSION['gmail'] = 1; $tBarGmail = true; } @@ -42,7 +42,7 @@ if (!isset($_GET['APP_UID']) && !isset($_GET['APP_NUMBER']) && !isset($_GET['DEL if (!isset($_GET['APP_UID']) && isset($_GET['APP_NUMBER'])) { $oCase = new Cases(); $appUid = $oCase->getApplicationUIDByNumber(htmlspecialchars($_GET['APP_NUMBER'])); - if (is_null( $appUid )) { + if (is_null($appUid)) { throw new Exception(G::LoadTranslation('ID_CASE_DOES_NOT_EXISTS')); } } else { @@ -52,7 +52,7 @@ if (!isset($_GET['APP_UID']) && isset($_GET['APP_NUMBER'])) { if (!isset($_GET['DEL_INDEX'])) { $oCase = new Cases(); $delIndex = $oCase->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')); } $_GET['DEL_INDEX'] = $delIndex; @@ -65,7 +65,7 @@ $tasUid = (isset($_GET['TAS_UID'])) ? $tasUid = htmlspecialchars($_GET['TAS_UID' $oCase = new Cases(); $conf = new Configurations(); -$oHeadPublisher = & headPublisher::getSingleton(); +$oHeadPublisher = &headPublisher::getSingleton(); $urlToRedirectAfterPause = 'casesListExtJs'; @@ -75,34 +75,34 @@ if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) { $pmGoogle = new PmGoogleApi(); if (array_key_exists('gmail', $_SESSION) && $_SESSION['gmail'] == 1 && $pmGoogle->getServiceGmailStatus()) { $_SESSION['gmail'] = 0; - $urlToRedirectAfterPause = '/sys'. $_SESSION['WORKSPACE'] .'/en/neoclassic/cases/cases_Open?APP_UID='.$_SESSION['APPLICATION'].'&DEL_INDEX='.$_SESSION['INDEX'].'&action=sent'; + $urlToRedirectAfterPause = '/sys' . $_SESSION['WORKSPACE'] . '/en/neoclassic/cases/cases_Open?APP_UID=' . $_SESSION['APPLICATION'] . '&DEL_INDEX=' . $_SESSION['INDEX'] . '&action=sent'; } } /*----------------------------------********---------------------------------*/ -$oHeadPublisher->assign( 'urlToRedirectAfterPause', $urlToRedirectAfterPause ); +$oHeadPublisher->assign('urlToRedirectAfterPause', $urlToRedirectAfterPause); -$oHeadPublisher->addExtJsScript( 'app/main', true ); -$oHeadPublisher->addExtJsScript( 'cases/open', true ); -$oHeadPublisher->assign( 'FORMATS', $conf->getFormats() ); +$oHeadPublisher->addExtJsScript('app/main', true); +$oHeadPublisher->addExtJsScript('cases/open', true); +$oHeadPublisher->assign('FORMATS', $conf->getFormats()); $uri = ''; foreach ($_GET as $k => $v) { $uri .= ($uri == '') ? "$k=$v" : "&$k=$v"; } -if( isset($_GET['action']) && ($_GET['action'] == 'jump') ) { +if (isset($_GET['action']) && ($_GET['action'] == 'jump')) { $oNewCase = new \ProcessMaker\BusinessModel\Cases(); //We need to get the last index OPEN or CLOSED (by Paused cases) //Set true because we need to check if the case is paused $delIndex = $oNewCase->getOneLastThread($appUid, true); - $case = $oCase->loadCase( $appUid, $delIndex, $_GET['action']); + $case = $oCase->loadCase($appUid, $delIndex, $_GET['action']); } else { - $case = $oCase->loadCase( $appUid, $delIndex ); + $case = $oCase->loadCase($appUid, $delIndex); } -if(isset($_GET['actionFromList']) && ($_GET['actionFromList'] === 'to_revise') ){ +if (isset($_GET['actionFromList']) && ($_GET['actionFromList'] === 'to_revise')) { $oSupervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor(); $caseCanBeReview = $oSupervisor->reviewCaseStatusForSupervisor($appUid, $delIndex); //Check if the case has the correct status for update the information from supervisor/review @@ -112,9 +112,9 @@ if(isset($_GET['actionFromList']) && ($_GET['actionFromList'] === 'to_revise') ) } 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' ) ); + $oHeadPublisher->assign('treeToReviseTitle', G::loadtranslation('ID_STEP_LIST')); $casesPanelUrl = 'casesToReviseTreeContent?APP_UID=' . $appUid . '&DEL_INDEX=' . $delIndex; - $oHeadPublisher->assign( 'casesPanelUrl', $casesPanelUrl ); //translations + $oHeadPublisher->assign('casesPanelUrl', $casesPanelUrl); //translations echo "
"; } } else { @@ -133,24 +133,24 @@ while ($ds->next()) { $bpmnProjects[] = $row['PRJ_UID']; } $oStep = new Step(); -$oStep = $oStep->loadByProcessTaskPosition( $case['PRO_UID'], $case['TAS_UID'], 1 ); -$oHeadPublisher->assign( 'uri', $script . $uri ); -$oHeadPublisher->assign( '_APP_NUM', '#: ' . $case['APP_NUMBER'] ); -$oHeadPublisher->assign( '_PROJECT_TYPE', in_array($case['PRO_UID'], $bpmnProjects) ? 'bpmn' : 'classic' ); -$oHeadPublisher->assign( '_PRO_UID', $case['PRO_UID']); -$oHeadPublisher->assign( '_APP_UID', $appUid); -$oHeadPublisher->assign( '_ENV_CURRENT_DATE', $conf->getSystemDate( date( 'Y-m-d' ) ) ); -$oHeadPublisher->assign( '_ENV_CURRENT_DATE_NO_FORMAT', date( 'Y-m-d-h-i-A' ) ); -$oHeadPublisher->assign( 'idfirstform', is_null( $oStep ) ? '' : $oStep->getStepUidObj() ); -$oHeadPublisher->assign( 'appStatus', $case['APP_STATUS'] ); -$oHeadPublisher->assign( 'tbarGmail', $tBarGmail); +$oStep = $oStep->loadByProcessTaskPosition($case['PRO_UID'], $case['TAS_UID'], 1); +$oHeadPublisher->assign('uri', $script . $uri); +$oHeadPublisher->assign('_APP_NUM', '#: ' . $case['APP_NUMBER']); +$oHeadPublisher->assign('_PROJECT_TYPE', in_array($case['PRO_UID'], $bpmnProjects) ? 'bpmn' : 'classic'); +$oHeadPublisher->assign('_PRO_UID', $case['PRO_UID']); +$oHeadPublisher->assign('_APP_UID', $appUid); +$oHeadPublisher->assign('_ENV_CURRENT_DATE', $conf->getSystemDate(date('Y-m-d'))); +$oHeadPublisher->assign('_ENV_CURRENT_DATE_NO_FORMAT', date('Y-m-d-h-i-A')); +$oHeadPublisher->assign('idfirstform', is_null($oStep) ? '-1' : $oStep->getStepUidObj()); +$oHeadPublisher->assign('appStatus', $case['APP_STATUS']); +$oHeadPublisher->assign('tbarGmail', $tBarGmail); -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['APPLICATION'] = $case['APP_UID']; $_SESSION['TASK'] = $case['TAS_UID']; $_SESSION['INDEX'] = $case['DEL_INDEX']; } $_SESSION['actionCaseOptions'] = (isset($_REQUEST['action'])) ? $_REQUEST['action'] : ''; -G::RenderPage( 'publish', 'extJs' ); +G::RenderPage('publish', 'extJs'); From e89d4950e1c522fbdb9d3576b38be7362cade706 Mon Sep 17 00:00:00 2001 From: Paula Quispe Date: Tue, 26 Sep 2017 14:53:05 -0400 Subject: [PATCH 24/85] HOR-3912 --- workflow/engine/classes/Applications.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/workflow/engine/classes/Applications.php b/workflow/engine/classes/Applications.php index 2cc198869..0d7b60e03 100644 --- a/workflow/engine/classes/Applications.php +++ b/workflow/engine/classes/Applications.php @@ -110,8 +110,10 @@ class Applications $sqlData .= " AND APPLICATION.APP_STATUS = 'TO_DO'"; break; default: //All status + //When the status is TO_DO, we will get all the open threads $sqlData .= " AND (APP_DELEGATION.DEL_THREAD_STATUS = 'OPEN' "; - $sqlData .= " OR (APP_DELEGATION.DEL_THREAD_STATUS = 'CLOSED' AND APP_DELEGATION.DEL_LAST_INDEX = 1)) "; + //When the status is COMPLETED, we will get the last task that with completed the case + $sqlData .= " OR (APP_DELEGATION.DEL_THREAD_STATUS = 'CLOSED' AND APP_DELEGATION.DEL_LAST_INDEX = 1 AND APPLICATION.APP_STATUS_ID = 3)) "; break; } From 949641c11b10876dea1d81f2aa83772676a94766 Mon Sep 17 00:00:00 2001 From: Paula Quispe Date: Tue, 26 Sep 2017 16:55:59 -0400 Subject: [PATCH 25/85] HOR-3936 --- workflow/engine/classes/model/ListInbox.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/workflow/engine/classes/model/ListInbox.php b/workflow/engine/classes/model/ListInbox.php index 77fbfb4ab..c97fa5fc6 100644 --- a/workflow/engine/classes/model/ListInbox.php +++ b/workflow/engine/classes/model/ListInbox.php @@ -645,10 +645,9 @@ class ListInbox extends BaseListInbox $filters['usr_uid'] = $usrUid; $criteria = new Criteria(); $criteria->addSelectColumn('COUNT(*) AS TOTAL'); - $criteria->add(ListInboxPeer::USR_UID, $usrUid, Criteria::EQUAL); - if (count($filters)) { - self::loadFilters($criteria, $filters); - } + + //The function loadFilters will add some condition in the query + $this->loadFilters($criteria, $filters); $dataset = ListInboxPeer::doSelectRS($criteria); $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $dataset->next(); From 23979fe30f8a67574145b2288414be6d125a475f Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 8 Sep 2017 14:32:25 -0400 Subject: [PATCH 26/85] FBI-2112: Remove library added for download file and create a similar method --- workflow/engine/templates/cases/pmdynaform.html | 1 - 1 file changed, 1 deletion(-) diff --git a/workflow/engine/templates/cases/pmdynaform.html b/workflow/engine/templates/cases/pmdynaform.html index aa199753e..e593e3597 100644 --- a/workflow/engine/templates/cases/pmdynaform.html +++ b/workflow/engine/templates/cases/pmdynaform.html @@ -14,7 +14,6 @@ - From 9bb07bbc2a91ba95ea7502f6ff412656098997a7 Mon Sep 17 00:00:00 2001 From: Paula Quispe Date: Fri, 29 Sep 2017 10:33:41 -0400 Subject: [PATCH 27/85] HOR-3901 --- workflow/engine/classes/WsBase.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/workflow/engine/classes/WsBase.php b/workflow/engine/classes/WsBase.php index 4040fb5da..890a595b2 100644 --- a/workflow/engine/classes/WsBase.php +++ b/workflow/engine/classes/WsBase.php @@ -2033,15 +2033,23 @@ class WsBase * This function is used when the case is derived from abe, Soap, PMFDerivateCase * * @param string $caseId, Uid related to the case - * @param array $appData, contain all the information about the case + * @param array $appData, contain all the information about the case related to the index [APP_DATA] * @param string $tasUid, Uid related to the task * @param string $stepType, before or after step * @param string $stepUidObj, can be -1, -2 * @param string $triggerType, can be BEFORE, AFTER - * @param string $labelAssigment, label related to the triggerType + * @param string $labelAssignment, label related to the triggerType + * + * @return string $varTriggers updated */ public function executeTriggerFromDerivate( - $caseId, $appData, $tasUid, $stepType, $stepUidObj, $triggerType, $labelAssigment = '' + $caseId, + $appData, + $tasUid, + $stepType, + $stepUidObj, + $triggerType, + $labelAssignment = '' ) { $varTriggers = ""; $oCase = new Cases(); @@ -2050,7 +2058,7 @@ class WsBase $aTriggers = $oCase->loadTriggers($tasUid, $stepType, $stepUidObj, $triggerType); if (count($aTriggers) > 0) { - $varTriggers = $varTriggers . "
" . $labelAssigment . "
"; + $varTriggers = $varTriggers . "
" . $labelAssignment . "
"; $oPMScript = new PMScript(); @@ -2064,6 +2072,7 @@ class WsBase $params->SID = $this->wsSessionId; } + //We can set the index APP_DATA $appFields["APP_DATA"] = array_merge($appData, G::getSystemConstants($params)); //PMScript @@ -2089,6 +2098,9 @@ class WsBase unset($appFields['APP_PROC_CODE']); unset($appFields['APP_PIN']); $oCase->updateCase($caseId, $appFields); + + //We need to update the variable $appData for use the new variables in the next trigger + $appData = array_merge($appData, $appFields['APP_DATA']); } } } From d377fc6b66c428e0396252633dc3d82dd7cbc963 Mon Sep 17 00:00:00 2001 From: Fabio Guachalla Date: Tue, 3 Oct 2017 15:07:14 -0400 Subject: [PATCH 28/85] FBI-2139:PM Tables - Warning should be hidden when the user decides to keep the data --- workflow/engine/templates/pmTables/edit.js | 25 +++++++++++++--------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/workflow/engine/templates/pmTables/edit.js b/workflow/engine/templates/pmTables/edit.js index ad56a8bcc..7e1d70bf8 100644 --- a/workflow/engine/templates/pmTables/edit.js +++ b/workflow/engine/templates/pmTables/edit.js @@ -814,18 +814,23 @@ Ext.onReady(function(){ loadTableRowsFromArray(TABLE.FIELDS); } - if (dataNumRows > 0) { - var tpl = new Ext.Template( - '' + var newEl, + tpl = new Ext.Template( + '' ); - var newEl = tpl.insertFirst(document.getElementById('assignedGrid')); - - Ext.fly('hideWarning').on('click', function() { - Ext.fly(newEl).slideOut('t',{remove:true}); + Ext.getCmp("chkKeepData").on('check', function () { + if (dataNumRows > 0 && Ext.getCmp("chkKeepData").checked === false) { + newEl = tpl.insertFirst(document.getElementById('assignedGrid')); + Ext.fly('hideWarning').on('click', function() { + Ext.fly(newEl).slideOut('t', {useDisplay:true}); + }); + Ext.fly(newEl).slideIn(); + } else if (Ext.getCmp("chkKeepData").checked === true) { + Ext.fly(newEl).slideOut('t', {useDisplay:true}); + } }); - Ext.fly(newEl).slideIn(); - } }); From 216e2dca28e1167fa1d3f32930e28f1e6ea5a78e Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Fri, 6 Oct 2017 17:21:21 -0400 Subject: [PATCH 29/85] HOR-3851 --- framework/src/Maveriks/WebApplication.php | 17 +++++++------- gulliver/bin/tasks/pakeGulliver.php | 4 +++- gulliver/includes/inc.ajax.php | 2 +- gulliver/system/class.bootstrap.php | 9 ++++---- gulliver/system/class.dbMaintenance.php | 4 ++-- gulliver/system/class.g.php | 10 ++++---- gulliver/system/class.menu.php | 4 ++-- gulliver/system/class.pmException.php | 2 +- gulliver/system/class.table.php | 2 +- gulliver/system/class.wysiwygEditor.php | 2 +- gulliver/system/class.xmlform.php | 6 ++--- tests/WorkflowTestCase.php | 4 ++-- .../ProcessMaker/BusinessModel/SkinsTest.php | 2 +- .../BusinessModel/WebEntryEventTest.php | 6 ++--- thirdparty/html2ps_pdf/config.inc.php | 2 +- thirdparty/pear/Log/file.php | 3 ++- workflow/engine/PmBootstrap.php | 4 ++-- workflow/engine/bin/cron_single.php | 7 +++--- workflow/engine/bin/reindex_solr.php | 7 +++--- workflow/engine/bin/tasks/cliAddons.php | 6 +++-- workflow/engine/bin/tasks/cliUpgrade.php | 3 ++- workflow/engine/bin/tasks/cliWorkspaces.php | 3 ++- workflow/engine/bin/verify_solr.php | 7 +++--- .../classes/ActionsByEmailCoreClass.php | 2 +- workflow/engine/classes/Applications.php | 2 +- workflow/engine/classes/Cases.php | 6 ++--- workflow/engine/classes/ConsolidatedCases.php | 2 +- workflow/engine/classes/Derivation.php | 2 +- workflow/engine/classes/EnterpriseClass.php | 4 ++-- .../engine/classes/IndicatorsCalculator.php | 2 +- workflow/engine/classes/LdapAdvanced.php | 2 +- .../engine/classes/PMLicensedFeatures.php | 4 ++-- workflow/engine/classes/PMPluginRegistry.php | 2 +- workflow/engine/classes/PmDrive.php | 2 +- workflow/engine/classes/PmDynaform.php | 18 +++++++-------- workflow/engine/classes/PmLicenseManager.php | 22 +++++++++--------- workflow/engine/classes/PmTable.php | 2 +- workflow/engine/classes/ProcessMap.php | 16 ++++++------- workflow/engine/classes/Processes.php | 14 +++++------ workflow/engine/classes/ReportTables.php | 4 ++-- workflow/engine/classes/ServerConf.php | 8 +++---- workflow/engine/classes/Upgrade.php | 2 +- workflow/engine/classes/WorkspaceTools.php | 23 +++++++++++++++---- workflow/engine/classes/class.pmFunctions.php | 6 ++--- workflow/engine/classes/class.pmScript.php | 4 ++-- workflow/engine/classes/class.webdav.php | 12 +++++----- .../engine/classes/model/AdditionalTables.php | 16 ++++++------- workflow/engine/classes/model/AddonsStore.php | 2 +- .../engine/classes/model/CaseScheduler.php | 2 +- workflow/engine/classes/model/Content.php | 5 +++- workflow/engine/classes/model/Process.php | 6 ++--- .../engine/classes/model/UsersProperties.php | 16 ++++++------- workflow/engine/config/databases.php | 6 ++--- workflow/engine/controllers/admin.php | 2 +- workflow/engine/controllers/adminProxy.php | 10 ++++---- .../engine/controllers/caseSchedulerProxy.php | 2 +- workflow/engine/controllers/designer.php | 4 ++-- workflow/engine/controllers/home.php | 2 +- workflow/engine/controllers/installer.php | 1 + workflow/engine/controllers/main.php | 10 ++++---- workflow/engine/controllers/pmTables.php | 2 +- workflow/engine/controllers/pmTablesProxy.php | 16 ++++++------- .../engine/controllers/strategicDashboard.php | 4 ++-- workflow/engine/controllers/webEntryProxy.php | 18 +++++++-------- .../engine/methods/cases/caseConsolidated.php | 2 +- .../cases/casesConsolidatedListExtJs.php | 2 +- .../engine/methods/cases/casesListExtJs.php | 4 ++-- .../cases/cases_SaveDataSupervisor.php | 8 +++---- .../methods/cases/cases_SaveDocument.php | 12 +++++----- .../cases/cases_SchedulerValidateUser.php | 2 +- .../methods/cases/cases_ShowDocument.php | 4 ++-- .../cases/cases_ShowOutputDocument.php | 4 ++-- workflow/engine/methods/cases/main_init.php | 2 +- .../engine/methods/enterprise/addonsStore.php | 2 +- .../methods/enterprise/addonsStoreAction.php | 2 +- .../engine/methods/enterprise/enterprise.php | 10 ++++---- .../methods/enterprise/processMakerAjax.php | 2 +- .../engine/methods/login/authentication.php | 8 +++---- .../methods/login/authenticationSso.php | 4 ++-- workflow/engine/methods/login/login.php | 6 ++--- workflow/engine/methods/oauth2/grant.php | 2 +- .../engine/methods/processes/consolidated.php | 4 ++-- .../engine/methods/processes/mainInit.php | 2 +- .../methods/processes/processesList.php | 2 +- .../methods/processes/processes_Ajax.php | 8 +++---- .../processes/processes_DownloadFile.php | 2 +- .../methods/processes/processes_Export.php | 2 +- .../processes/processes_Import_Ajax.php | 2 +- .../processes/processes_webEntryGenerate.php | 12 +++++----- .../processes/processes_webEntryValidate.php | 2 +- .../methods/processes/webEntry_Val_Assig.php | 2 +- workflow/engine/methods/services/webdav.php | 2 +- workflow/engine/methods/services/wsdl2.php | 2 +- .../engine/methods/setup/auditLogAjax.php | 2 +- workflow/engine/methods/setup/cronAjax.php | 2 +- .../engine/methods/setup/languages_Import.php | 2 +- .../methods/setup/loginSettingsAjax.php | 2 +- .../engine/methods/setup/pluginsChange.php | 2 +- .../methods/setup/pluginsImportFile.php | 2 +- workflow/engine/methods/setup/pluginsList.php | 2 +- workflow/engine/methods/setup/pluginsMain.php | 2 +- .../engine/methods/setup/replacementLogo.php | 2 +- workflow/engine/methods/setup/skin_Ajax.php | 4 ++-- workflow/engine/methods/setup/skinsList.php | 2 +- .../engine/methods/setup/webServicesAjax.php | 14 +++++------ .../engine/methods/setup/webServicesSetup.php | 2 +- .../methods/tracker/tracker_ShowDocument.php | 4 ++-- .../tracker/tracker_ShowOutputDocument.php | 4 ++-- .../engine/methods/triggers/triggers_Save.php | 2 +- workflow/engine/methods/users/usersEdit.php | 2 +- workflow/engine/methods/users/usersInit.php | 2 +- workflow/engine/methods/users/usersNew.php | 2 +- .../plugins/openFlash/class.openFlash.php | 2 +- .../pmosCommunity/class.pmosCommunity.php | 2 +- workflow/engine/skinEngine/skinEngine.php | 20 ++++++++-------- .../BusinessModel/ActionsByEmail.php | 2 +- .../src/ProcessMaker/BusinessModel/Cases.php | 2 +- .../BusinessModel/Cases/InputDocument.php | 20 ++++++++-------- .../BusinessModel/Consolidated.php | 4 ++-- .../ProcessMaker/BusinessModel/EmailEvent.php | 2 +- .../BusinessModel/EmailServer.php | 2 +- .../src/ProcessMaker/BusinessModel/Light.php | 10 ++++---- .../Light/NotificationDevice.php | 2 +- .../BusinessModel/MessageApplication.php | 4 ++-- .../BusinessModel/Migrator/FileHandler.php | 2 +- .../BusinessModel/Migrator/FilesMigrator.php | 2 +- .../Migrator/GranularExporter.php | 4 ++-- .../Migrator/TemplatesMigrator.php | 2 +- .../ProcessMaker/BusinessModel/Process.php | 6 ++--- .../BusinessModel/ProjectUser.php | 4 ++-- .../src/ProcessMaker/BusinessModel/Skins.php | 2 +- .../src/ProcessMaker/BusinessModel/Table.php | 4 ++-- .../ProcessMaker/BusinessModel/TimerEvent.php | 6 ++--- .../ProcessMaker/BusinessModel/Trigger.php | 2 +- .../src/ProcessMaker/BusinessModel/User.php | 2 +- .../ProcessMaker/BusinessModel/WebEntry.php | 4 ++-- .../BusinessModel/WebEntryEvent.php | 4 ++-- .../engine/src/ProcessMaker/Core/System.php | 2 +- .../src/ProcessMaker/Exporter/Exporter.php | 2 +- .../src/ProcessMaker/Importer/Importer.php | 2 +- .../ProcessMaker/Plugins/PluginRegistry.php | 9 ++++---- .../engine/src/ProcessMaker/Project/Bpmn.php | 2 +- .../src/ProcessMaker/Project/Workflow.php | 6 ++--- .../src/ProcessMaker/Services/Api/Project.php | 4 ++-- .../ProcessMaker/Services/OAuth2/Server.php | 10 ++++---- .../ProcessMaker/Util/FixReferencePath.php | 2 +- .../engine/src/ProcessMaker/Util/System.php | 2 +- .../engine/src/ProcessMaker/Util/helpers.php | 4 ++-- .../templates/setup/webServicesTree.php | 6 ++--- workflow/public_html/bootstrap.php | 14 +++++------ workflow/public_html/sysGeneric.php | 19 +++++++-------- 151 files changed, 402 insertions(+), 373 deletions(-) diff --git a/framework/src/Maveriks/WebApplication.php b/framework/src/Maveriks/WebApplication.php index 817864831..331b956ec 100644 --- a/framework/src/Maveriks/WebApplication.php +++ b/framework/src/Maveriks/WebApplication.php @@ -290,7 +290,7 @@ class WebApplication } // Setting current workspace to Api class - Services\Api::setWorkspace(SYS_SYS); + Services\Api::setWorkspace(config("sys_sys")); $cacheDir = defined("PATH_WORKSPACE") ? PATH_WORKSPACE : (defined("PATH_C") ? PATH_C : sys_get_temp_dir()); $sysConfig = System::getSystemConfiguration(); @@ -387,7 +387,7 @@ class WebApplication } } - Services\OAuth2\Server::setWorkspace(SYS_SYS); + Services\OAuth2\Server::setWorkspace(config("sys_sys")); $this->rest->addAPIClass('\ProcessMaker\\Services\\OAuth2\\Server', 'oauth2'); return $uri; @@ -498,15 +498,16 @@ class WebApplication } define("SYS_SYS", $workspace); + config(["sys_sys" => $workspace]); - if (!file_exists(PATH_DB . SYS_SYS . PATH_SEP . "db.php")) { + if (!file_exists(PATH_DB . config("sys_sys") . PATH_SEP . "db.php")) { $rest = new \Maveriks\Extension\Restler(); $rest->setMessage(new RestException(Api::STAT_APP_EXCEPTION, \G::LoadTranslation("ID_NOT_WORKSPACE"))); exit(0); } - $arraySystemConfiguration = System::getSystemConfiguration('', '', SYS_SYS); + $arraySystemConfiguration = System::getSystemConfiguration('', '', config("sys_sys")); //Do not change any of these settings directly, use env.ini instead ini_set('display_errors', $arraySystemConfiguration['display_errors']); @@ -524,11 +525,11 @@ class WebApplication define('SYS_SKIN', $arraySystemConfiguration['default_skin']); define('DISABLE_DOWNLOAD_DOCUMENTS_SESSION_VALIDATION', $arraySystemConfiguration['disable_download_documents_session_validation']); - require_once(PATH_DB . SYS_SYS . "/db.php"); + require_once(PATH_DB . config("sys_sys") . "/db.php"); // defining constant for workspace shared directory - $this->workspaceDir = PATH_DB . SYS_SYS . PATH_SEP; - $this->workspaceCacheDir = PATH_DB . SYS_SYS . PATH_SEP . "cache" . PATH_SEP; + $this->workspaceDir = PATH_DB . config("sys_sys") . PATH_SEP; + $this->workspaceCacheDir = PATH_DB . config("sys_sys") . PATH_SEP . "cache" . PATH_SEP; define("PATH_WORKSPACE", $this->workspaceDir); // including workspace shared classes -> particularlly for pmTables @@ -539,7 +540,7 @@ class WebApplication define("PATH_SMARTY_C", PATH_C . "smarty" . PATH_SEP . "c"); define("PATH_SMARTY_CACHE", PATH_C . "smarty" . PATH_SEP . "cache"); - define("PATH_DATA_SITE", PATH_DATA . "sites/" . SYS_SYS . "/"); + define("PATH_DATA_SITE", PATH_DATA . "sites/" . config("sys_sys") . "/"); define("PATH_DOCUMENT", PATH_DATA_SITE . "files/"); define("PATH_DATA_MAILTEMPLATES", PATH_DATA_SITE . "mailTemplates/"); define("PATH_DATA_PUBLIC", PATH_DATA_SITE . "public/"); diff --git a/gulliver/bin/tasks/pakeGulliver.php b/gulliver/bin/tasks/pakeGulliver.php index 804529e07..9400e1d34 100644 --- a/gulliver/bin/tasks/pakeGulliver.php +++ b/gulliver/bin/tasks/pakeGulliver.php @@ -2230,7 +2230,9 @@ function run_update_plugin_attributes($task, $args) //Set variables $pluginName = $args[0]; // virtual SYS_SYS for cache - define('SYS_SYS', uniqid()); + $sys_sys = uniqid(); + define('SYS_SYS', $sys_sys); + config(["sys_sys" => $sys_sys]); foreach (PmSystem::listWorkspaces() as $value) { \ProcessMaker\Util\Cnn::connect($value->name); //Update plugin attributes diff --git a/gulliver/includes/inc.ajax.php b/gulliver/includes/inc.ajax.php index 84a828a0c..733126849 100644 --- a/gulliver/includes/inc.ajax.php +++ b/gulliver/includes/inc.ajax.php @@ -107,5 +107,5 @@ } function ajax_LoadJavaScript( $phpMethod, $phpFile ) { - print ' LoadPopJavaScript ( "/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/tools/loadJavaScript.html?method=' .$phpMethod . '&file=' . $phpFile . "\");\n"; + print ' LoadPopJavaScript ( "/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/tools/loadJavaScript.html?method=' .$phpMethod . '&file=' . $phpFile . "\");\n"; } diff --git a/gulliver/system/class.bootstrap.php b/gulliver/system/class.bootstrap.php index 87a972836..62dbd70d3 100644 --- a/gulliver/system/class.bootstrap.php +++ b/gulliver/system/class.bootstrap.php @@ -2122,7 +2122,7 @@ class Bootstrap } if (defined("SYS_SYS")) { - $sysCon["SYS_SYS"] = SYS_SYS; + $sysCon["SYS_SYS"] = config("sys_sys"); } $sysCon["APPLICATION"] = (isset($_SESSION["APPLICATION"])) ? $_SESSION["APPLICATION"] : ""; @@ -2682,7 +2682,7 @@ class Bootstrap * @return array $aContext void */ public static function getDefaultContextLog(){ - $sysSys = (defined("SYS_SYS"))? SYS_SYS : "Undefined"; + $sysSys = (defined("SYS_SYS"))? config("sys_sys") : "Undefined"; $date = \ProcessMaker\Util\DateTime::convertUtcToTimeZone(date('Y-m-d H:m:s')); $aContext = array( 'ip' => \G::getIpAddress() @@ -2722,7 +2722,7 @@ class Bootstrap $context['url'] = SYS_CURRENT_URI . '?' . SYS_CURRENT_PARMS; } $context['usrUid'] = isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : ''; - $sysSys = defined("SYS_SYS") ? SYS_SYS : "Undefined"; + $sysSys = defined("SYS_SYS") ? config("sys_sys") : "Undefined"; \Bootstrap::registerMonolog($channel, $level, $message, $context, $sysSys, 'processmaker.log'); } @@ -2737,9 +2737,10 @@ class Bootstrap if (!defined('SYS_SYS') && !is_null($wsName)) { //If SYS_SYS exists, is not update with $wsName define('SYS_SYS', $wsName); + config(["sys_sys" => $wsName]); } if (defined('SYS_SYS') && !defined('PATH_DATA_SITE')) { - define('PATH_DATA_SITE', PATH_DATA . 'sites' . PATH_SEP . SYS_SYS . PATH_SEP); + define('PATH_DATA_SITE', PATH_DATA . 'sites' . PATH_SEP . config("sys_sys") . PATH_SEP); } if (defined('PATH_DATA_SITE') && !defined('PATH_WORKSPACE')) { define('PATH_WORKSPACE', PATH_DATA_SITE); diff --git a/gulliver/system/class.dbMaintenance.php b/gulliver/system/class.dbMaintenance.php index c61de7110..7b0c640e8 100644 --- a/gulliver/system/class.dbMaintenance.php +++ b/gulliver/system/class.dbMaintenance.php @@ -267,7 +267,7 @@ class DataBaseMaintenance // Commented that is not assigned to a variable. // mysql_escape_string("';"); if (! @mysql_query( $sql )) { - $ws = (defined("SYS_SYS"))? SYS_SYS : "Wokspace Undefined"; + $ws = (defined("SYS_SYS"))? config("sys_sys") : "Wokspace Undefined"; Bootstrap::registerMonolog('MysqlCron', 400, mysql_error(), array('sql'=>$sql), $ws, 'processmaker.log'); $varRes = mysql_error() . "\n"; G::outRes( $varRes ); @@ -288,7 +288,7 @@ class DataBaseMaintenance $tableName = str_replace( '.dump', '', basename( $backupFile ) ); $sql = "LOAD DATA INFILE '$backupFile' INTO TABLE $tableName FIELDS TERMINATED BY '\t|\t' OPTIONALLY ENCLOSED BY '\"' LINES TERMINATED BY '\t\t\r\r\n'"; if (! @mysql_query( $sql )) { - $ws = (defined("SYS_SYS"))? SYS_SYS : "Wokspace Undefined"; + $ws = (defined("SYS_SYS"))? config("sys_sys") : "Wokspace Undefined"; Bootstrap::registerMonolog('MysqlCron', 400, mysql_error(), array('sql'=>$sql), $ws, 'processmaker.log'); $varRes = mysql_error() . "\n"; G::outRes( $varRes ); diff --git a/gulliver/system/class.g.php b/gulliver/system/class.g.php index 477578c59..67ba14288 100644 --- a/gulliver/system/class.g.php +++ b/gulliver/system/class.g.php @@ -2448,7 +2448,7 @@ class G global $RBAC; if (isset( $_SESSION['USER_LOGGED'] ) && $_SESSION['USER_LOGGED'] == '') { - $sys = (ENABLE_ENCRYPT == 'yes' ? SYS_SYS : "sys" . SYS_SYS); + $sys = (ENABLE_ENCRYPT == 'yes' ? config("sys_sys") : "sys" . config("sys_sys")); $lang = (ENABLE_ENCRYPT == 'yes' ? G::encrypt( urldecode( SYS_LANG ), URL_KEY ) : SYS_LANG); $skin = (ENABLE_ENCRYPT == 'yes' ? G::encrypt( urldecode( SYS_SKIN ), URL_KEY ) : SYS_SKIN); $login = (ENABLE_ENCRYPT == 'yes' ? G::encrypt( urldecode( 'login' ), URL_KEY ) : 'login'); @@ -2466,7 +2466,7 @@ class G $sessionBrowser = defined( 'SESSION_BROWSER' ) ? SESSION_BROWSER : ''; if (($sessionPc == "1") or ($sessionBrowser == "1")) { if ($row['LOG_STATUS'] == 'X') { - $sys = (ENABLE_ENCRYPT == 'yes' ? SYS_SYS : "sys" . SYS_SYS); + $sys = (ENABLE_ENCRYPT == 'yes' ? config("sys_sys") : "sys" . config("sys_sys")); $lang = (ENABLE_ENCRYPT == 'yes' ? G::encrypt( urldecode( SYS_LANG ), URL_KEY ) : SYS_LANG); $skin = (ENABLE_ENCRYPT == 'yes' ? G::encrypt( urldecode( SYS_SKIN ), URL_KEY ) : SYS_SKIN); $login = (ENABLE_ENCRYPT == 'yes' ? G::encrypt( urldecode( 'login' ), URL_KEY ) : 'login'); @@ -2502,7 +2502,7 @@ class G if ($sw == 0 && $urlNoAccess != "") { $aux = explode( '/', $urlNoAccess ); - $sys = (ENABLE_ENCRYPT == 'yes' ? SYS_SYS : "/sys" . SYS_LANG); + $sys = (ENABLE_ENCRYPT == 'yes' ? config("sys_sys") : "/sys" . SYS_LANG); $lang = (ENABLE_ENCRYPT == 'yes' ? G::encrypt( urldecode( SYS_LANG ), URL_KEY ) : SYS_LANG); $skin = (ENABLE_ENCRYPT == 'yes' ? G::encrypt( urldecode( SYS_SKIN ), URL_KEY ) : SYS_SKIN); $login = (ENABLE_ENCRYPT == 'yes' ? G::encrypt( urldecode( $aux[0] ), URL_KEY ) : $aux[0]); @@ -2977,7 +2977,7 @@ class G } if (defined("SYS_SYS")) { - $sysCon["SYS_SYS"] = SYS_SYS; + $sysCon["SYS_SYS"] = config("sys_sys"); } $sysCon["APPLICATION"] = (isset($_SESSION["APPLICATION"]))? $_SESSION["APPLICATION"] : ""; @@ -5445,7 +5445,7 @@ class G */ public static function auditLog($actionToLog, $valueToLog = "") { - $workspace = defined('SYS_SYS') ? SYS_SYS : 'Wokspace Undefined'; + $workspace = defined('SYS_SYS') ? config("sys_sys") : 'Wokspace Undefined'; $conf = new Configurations(); $sflag = $conf->getConfiguration('AUDIT_LOG', 'log'); $sflagAudit = $sflag == 'true' ? true : false; diff --git a/gulliver/system/class.menu.php b/gulliver/system/class.menu.php index a50fc0b26..d1137a852 100644 --- a/gulliver/system/class.menu.php +++ b/gulliver/system/class.menu.php @@ -310,9 +310,9 @@ class Menu $target = $this->Options[$intPos]; if ($this->Types[$intPos] != "absolute") { if (defined('ENABLE_ENCRYPT')) { - $target = "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/" . $target; + $target = "/sys" . config("sys_sys") . "/" . SYS_LANG . "/" . SYS_SKIN . "/" . $target; } elseif (defined('SYS_SYS')) { - $target = "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/" . $target; + $target = "/sys" . config("sys_sys") . "/" . SYS_LANG . "/" . SYS_SKIN . "/" . $target; } else { $target = "/sys/" . SYS_LANG . "/" . SYS_SKIN . "/" . $target; } diff --git a/gulliver/system/class.pmException.php b/gulliver/system/class.pmException.php index e428cec9f..edd805e60 100644 --- a/gulliver/system/class.pmException.php +++ b/gulliver/system/class.pmException.php @@ -21,7 +21,7 @@ class PMException extends Exception } public static function registerErrorLog($error, $token){ - $ws = (defined("SYS_SYS"))? SYS_SYS : "Wokspace Undefined"; + $ws = (defined("SYS_SYS"))? config("sys_sys") : "Wokspace Undefined"; Bootstrap::registerMonolog('ExceptionCron', 400, $error->getMessage(), array('token'=>$token), $ws, 'processmaker.log'); } } diff --git a/gulliver/system/class.table.php b/gulliver/system/class.table.php index c89886940..ed1e3157f 100644 --- a/gulliver/system/class.table.php +++ b/gulliver/system/class.table.php @@ -461,7 +461,7 @@ class Table //$res .= "" . $this->Labels[$intPos] . ""; diff --git a/gulliver/system/class.wysiwygEditor.php b/gulliver/system/class.wysiwygEditor.php index 15e6a6782..53ed946cf 100644 --- a/gulliver/system/class.wysiwygEditor.php +++ b/gulliver/system/class.wysiwygEditor.php @@ -75,7 +75,7 @@ class XmlFormFieldWYSIWYGEditor extends XmlFormField public function attachEvents ($element) { $editorDefinition = 'tinyMCE.baseURL = "/js/tinymce/jscripts/tiny_mce"; '; - $editorDefinition .= 'var domainURL = "/sys'.SYS_SYS.'/'.SYS_LANG.'/'.SYS_SKIN.'/"'; + $editorDefinition .= 'var domainURL = "/sys'.config("sys_sys").'/'.SYS_LANG.'/'.SYS_SKIN.'/"'; $serverConf =& ServerConf::getSingleton(); switch ($this->editorType){ diff --git a/gulliver/system/class.xmlform.php b/gulliver/system/class.xmlform.php index 43d70a182..0b4b4eeab 100644 --- a/gulliver/system/class.xmlform.php +++ b/gulliver/system/class.xmlform.php @@ -255,7 +255,7 @@ class XmlFormField $rs = $con->executeQuery( $query, ResultSet::FETCHMODE_NUM ); } catch (Exception $e) { //dismiss error because dbarray shouldnt be defined in some contexts. - $workspace = defined("SYS_SYS")? SYS_SYS : "Wokspace Undefined"; + $workspace = defined("SYS_SYS")? config("sys_sys") : "Wokspace Undefined"; G::log($workspace . " | ip: | " . G::getIpAddress() . " | type error: | " . $e->getMessage() . " | query: " . $query, PATH_DATA, "queriesWithErrors.log"); return $result; @@ -267,7 +267,7 @@ class XmlFormField $rs = $stmt->executeQuery( $query, ResultSet::FETCHMODE_NUM ); } catch (Exception $e) { //dismiss error because dbarray shouldnt be defined in some contexts. - $workspace = defined("SYS_SYS")? SYS_SYS : "Wokspace Undefined"; + $workspace = defined("SYS_SYS")? config("sys_sys") : "Wokspace Undefined"; G::log($workspace . " | ip: | " . G::getIpAddress() . " | type error: | " . $e->getMessage() . " | query: " . $query, PATH_DATA, "queriesWithErrors.log"); return $result; @@ -5482,7 +5482,7 @@ class XmlForm $this->fileName = $filename; $parsedFile = dirname( $filename ) . PATH_SEP . basename( $filename, 'xml' ) . $language; - $parsedFilePath = defined( 'PATH_C' ) ? (defined( 'SYS_SYS' ) ? PATH_C . 'ws' . PATH_SEP . SYS_SYS . PATH_SEP : PATH_C) : PATH_DATA; + $parsedFilePath = defined( 'PATH_C' ) ? (defined( 'SYS_SYS' ) ? PATH_C . 'ws' . PATH_SEP . config("sys_sys") . PATH_SEP : PATH_C) : PATH_DATA; $parsedFilePath .= 'xmlform/' . substr( $parsedFile, strlen( $this->home ) ); // Improvement for the js cache - Start diff --git a/tests/WorkflowTestCase.php b/tests/WorkflowTestCase.php index ccef158c9..2dcb6547d 100644 --- a/tests/WorkflowTestCase.php +++ b/tests/WorkflowTestCase.php @@ -28,7 +28,7 @@ class WorkflowTestCase extends TestCase $pdo->exec(file_get_contents(PATH_RBAC_CORE.'data/mysql/insert.sql')); $pdo->exec("INSERT INTO `APP_SEQUENCE` (`ID`) VALUES ('1')"); $pdo->exec("INSERT INTO `OAUTH_CLIENTS` (`CLIENT_ID`, `CLIENT_SECRET`, `CLIENT_NAME`, `CLIENT_DESCRIPTION`, `CLIENT_WEBSITE`, `REDIRECT_URI`, `USR_UID`) VALUES -('x-pm-local-client', '179ad45c6ce2cb97cf1029e212046e81', 'PM Web Designer', 'ProcessMaker Web Designer App', 'www.processmaker.com', 'http://".$_SERVER["HTTP_HOST"].":".$_SERVER['SERVER_PORT']."/sys".SYS_SYS."/en/neoclassic/oauth2/grant', '00000000000000000000000000000001');"); +('x-pm-local-client', '179ad45c6ce2cb97cf1029e212046e81', 'PM Web Designer', 'ProcessMaker Web Designer App', 'www.processmaker.com', 'http://".$_SERVER["HTTP_HOST"].":".$_SERVER['SERVER_PORT']."/sys".config("sys_sys")."/en/neoclassic/oauth2/grant', '00000000000000000000000000000001');"); $pdo->exec("INSERT INTO `OAUTH_ACCESS_TOKENS` (`ACCESS_TOKEN`, `CLIENT_ID`, `USER_ID`, `EXPIRES`, `SCOPE`) VALUES ('39704d17049f5aef45e884e7b769989269502f83', 'x-pm-local-client', '00000000000000000000000000000001', '2017-06-15 17:55:19', 'view_processes edit_processes *');"); } @@ -193,7 +193,7 @@ class WorkflowTestCase extends TestCase protected function getBaseUrl($url) { return (\G::is_https() ? "https://" : "http://"). - $GLOBALS["APP_HOST"].':'.$GLOBALS['SERVER_PORT']."/sys".SYS_SYS."/". + $GLOBALS["APP_HOST"].':'.$GLOBALS['SERVER_PORT']."/sys".config("sys_sys")."/". SYS_LANG."/".SYS_SKIN."/".$url; } } diff --git a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/SkinsTest.php b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/SkinsTest.php index 35d96b958..bc04e29bd 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/SkinsTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/SkinsTest.php @@ -72,6 +72,6 @@ class SkinsTest extends \WorkflowTestCase $this->assertCount(4, $skins); $this->assertEquals($skins[2]['SKIN_FOLDER_ID'], 'test'); $this->assertEquals($skins[3]['SKIN_FOLDER_ID'], 'test2'); - $this->assertEquals($skins[3]['SKIN_WORKSPACE'], SYS_SYS); + $this->assertEquals($skins[3]['SKIN_WORKSPACE'], config("sys_sys")); } } diff --git a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEventTest.php b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEventTest.php index 156157b4f..b55aa3c9a 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEventTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEventTest.php @@ -284,7 +284,7 @@ class WebEntryEventTest extends \WorkflowTestCase $this->createWebEntryEvent( $processUid, $entryEvents, [ - 'WEE_URL' => $this->domain."/sys".SYS_SYS."/".SYS_LANG."/".SYS_SKIN."/".$processUid."/custom.php", + 'WEE_URL' => $this->domain."/sys".config("sys_sys")."/".SYS_LANG."/".SYS_SKIN."/".$processUid."/custom.php", 'WE_TYPE' => "NOT-VALID-SINGLE", 'WE_CUSTOM_TITLE' => $this->customTitle, 'WE_AUTHENTICATION' => 'NOT-VALID-ANONYMOUS', @@ -373,7 +373,7 @@ class WebEntryEventTest extends \WorkflowTestCase $webEntryEventUid, $userUidUpdater, [ - 'WEE_URL' => $this->domain."/sys".SYS_SYS."/".SYS_LANG."/".SYS_SKIN."/".$processUid."/custom.php", + 'WEE_URL' => $this->domain."/sys".config("sys_sys")."/".SYS_LANG."/".SYS_SKIN."/".$processUid."/custom.php", 'WE_TYPE' => "NOT-VALID-SINGLE", 'WE_CUSTOM_TITLE' => $this->customTitle, 'WE_AUTHENTICATION' => 'NOT-VALID-ANONYMOUS', @@ -671,7 +671,7 @@ class WebEntryEventTest extends \WorkflowTestCase private function getSimpleWebEntryUrl(\WebEntry $we) { return (\G::is_https() ? "https://" : "http://"). - $_SERVER["HTTP_HOST"]."/sys".SYS_SYS."/". + $_SERVER["HTTP_HOST"]."/sys".config("sys_sys")."/". SYS_LANG."/".SYS_SKIN."/".$we->getProUid()."/".$we->getWeData(); } diff --git a/thirdparty/html2ps_pdf/config.inc.php b/thirdparty/html2ps_pdf/config.inc.php index a056ae4da..bbed2fc5b 100644 --- a/thirdparty/html2ps_pdf/config.inc.php +++ b/thirdparty/html2ps_pdf/config.inc.php @@ -102,7 +102,7 @@ define('MAX_IMAGE_ROW_LEN',16); define('MAX_TRANSPARENT_IMAGE_ROW_LEN',16); define('CACHE_DIR', HTML2PS_DIR.'cache/'); -//define('OUTPUT_FILE_DIRECTORY', HTML2PS_DIR.'out/'.(defined('SYS_SYS') ? SYS_SYS . '/' : '')); +//define('OUTPUT_FILE_DIRECTORY', HTML2PS_DIR.'out/'.(defined('SYS_SYS') ? config("sys_sys") . '/' : '')); define('OUTPUT_FILE_DIRECTORY', PATH_OUTPUT_FILE_DIRECTORY); define('FPDF_PATH', HTML2PS_DIR.'fpdf/'); diff --git a/thirdparty/pear/Log/file.php b/thirdparty/pear/Log/file.php index cd6e6b7ef..63f308f06 100644 --- a/thirdparty/pear/Log/file.php +++ b/thirdparty/pear/Log/file.php @@ -286,6 +286,7 @@ class Log_file extends Log } if ( !defined('SYS_SYS') ) { define ('SYS_SYS', '' ); + config(["sys_sys" => ""]); } /* If a priority hasn't been specified, use the default value. */ if ($priority === null) { @@ -326,7 +327,7 @@ class Log_file extends Log $micro = date('H:i:s.') . sprintf("%04d", floor($usec * 10000 )); /* Build the string containing the complete message */ - $msg = sprintf ( "%s|%s|%s|%05d|%s|%s|%s|%s|%s\n", $micro,SYS_SYS,$ip, $myPid, $message, $backTrace[3], $method, $uri, $request); + $msg = sprintf ( "%s|%s|%s|%05d|%s|%s|%s|%s|%s\n", $micro,config("sys_sys"),$ip, $myPid, $message, $backTrace[3], $method, $uri, $request); /* Build the string containing the complete log line. */ $line = $this->_format('%4$s', $micro,'',$msg ); diff --git a/workflow/engine/PmBootstrap.php b/workflow/engine/PmBootstrap.php index 8c54c057c..1792c6cf5 100644 --- a/workflow/engine/PmBootstrap.php +++ b/workflow/engine/PmBootstrap.php @@ -239,11 +239,11 @@ class PmBootstrap extends Bootstrap public function initPropel($sys = '') { if (empty($sys)) { - if (! defined(SYS_SYS)) { + if (! defined("SYS_SYS")) { throw new Exception("Error: Undefined syemtem env. constant 'SYS_SYS'"); } - $sys = SYS_SYS; + $sys = config("sys_sys"); } // setup propel definitions and logging diff --git a/workflow/engine/bin/cron_single.php b/workflow/engine/bin/cron_single.php index ae686b118..2770e159a 100644 --- a/workflow/engine/bin/cron_single.php +++ b/workflow/engine/bin/cron_single.php @@ -132,12 +132,13 @@ try { if (is_dir(PATH_DB . $workspace) && file_exists(PATH_DB . $workspace . PATH_SEP . 'db.php')) { define('SYS_SYS', $workspace); + config(["sys_sys" => $workspace]); include_once(PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths_installed.php'); include_once(PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php'); //PM Paths DATA - define('PATH_DATA_SITE', PATH_DATA . 'sites/' . SYS_SYS . '/'); + define('PATH_DATA_SITE', PATH_DATA . 'sites/' . config("sys_sys") . '/'); define('PATH_DOCUMENT', PATH_DATA_SITE . 'files/'); define('PATH_DATA_MAILTEMPLATES', PATH_DATA_SITE . 'mailTemplates/'); define('PATH_DATA_PUBLIC', PATH_DATA_SITE . 'public/'); @@ -417,7 +418,7 @@ function executePlugins() } if ($handle = opendir($pathCronPlugins)) { - setExecutionMessage('Executing cron files in bin/plugins directory in Workspace: ' . SYS_SYS); + setExecutionMessage('Executing cron files in bin/plugins directory in Workspace: ' . config("sys_sys")); while (false !== ($file = readdir($handle))) { if (strpos($file, '.php',1) && is_file($pathCronPlugins . $file)) { $filename = str_replace('.php' , '', $file); @@ -437,7 +438,7 @@ function executePlugins() // -> Execute functions if (!empty($cronFiles)) { - setExecutionMessage('Executing registered cron files for Workspace: ' . SYS_SYS); + setExecutionMessage('Executing registered cron files for Workspace: ' . config("sys_sys")); foreach($cronFiles as $cronFile) { executeCustomCronFunction(PATH_PLUGINS . $cronFile->namespace . PATH_SEP . 'bin' . PATH_SEP . $cronFile->cronFile . '.php', $cronFile->cronFile); } diff --git a/workflow/engine/bin/reindex_solr.php b/workflow/engine/bin/reindex_solr.php index 13342fd4a..e35df1ca0 100644 --- a/workflow/engine/bin/reindex_solr.php +++ b/workflow/engine/bin/reindex_solr.php @@ -144,11 +144,12 @@ if (! defined ('SYS_SYS')) { if (file_exists (PATH_DB . $sObject . PATH_SEP . 'db.php')) { define ('SYS_SYS', $sObject); + config(["sys_sys" => $sObject]); // **************************************** // read initialize file require_once PATH_HOME . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'class.system.php'; - $config = System::getSystemConfiguration ('', '', SYS_SYS); + $config = System::getSystemConfiguration ('', '', config("sys_sys")); define ('MEMCACHED_ENABLED', $config ['memcached']); define ('MEMCACHED_SERVER', $config ['memcached_server']); define ('TIME_ZONE', $config ['time_zone']); @@ -170,7 +171,7 @@ if (! defined ('SYS_SYS')) { include_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php'); // ***************** PM Paths DATA ************************** - define ('PATH_DATA_SITE', PATH_DATA . 'sites/' . SYS_SYS . '/'); + define ('PATH_DATA_SITE', PATH_DATA . 'sites/' . config("sys_sys") . '/'); define ('PATH_DOCUMENT', PATH_DATA_SITE . 'files/'); define ('PATH_DATA_MAILTEMPLATES', PATH_DATA_SITE . 'mailTemplates/'); define ('PATH_DATA_PUBLIC', PATH_DATA_SITE . 'public/'); @@ -264,7 +265,7 @@ function processWorkspace() try { - if (($solrConf = System::solrEnv (SYS_SYS)) !== false) { + if (($solrConf = System::solrEnv (config("sys_sys"))) !== false) { print "Solr Configuration file: " . PATH_DATA_SITE . "env.ini\n"; print "solr_enabled: " . $solrConf ['solr_enabled'] . "\n"; print "solr_host: " . $solrConf ['solr_host'] . "\n"; diff --git a/workflow/engine/bin/tasks/cliAddons.php b/workflow/engine/bin/tasks/cliAddons.php index 52a6fdafe..fed5e5e74 100644 --- a/workflow/engine/bin/tasks/cliAddons.php +++ b/workflow/engine/bin/tasks/cliAddons.php @@ -48,9 +48,10 @@ function run_addon_core_install($args) if (!defined("SYS_SYS")) { define("SYS_SYS", $workspace); + config(["sys_sys" => $workspace]); } if (!defined("PATH_DATA_SITE")) { - define("PATH_DATA_SITE", PATH_DATA . "sites/" . SYS_SYS . "/"); + define("PATH_DATA_SITE", PATH_DATA . "sites/" . config("sys_sys") . "/"); } if (!defined("DB_ADAPTER")) { define("DB_ADAPTER", $args[3]); @@ -104,9 +105,10 @@ function change_hash($command, $opts) $response->hash = $hash; if (!defined("SYS_SYS")) { define("SYS_SYS", $workspace->name); + config(["sys_sys" => $workspace->name]); } if (!defined("PATH_DATA_SITE")) { - define("PATH_DATA_SITE", PATH_DATA . "sites/" . SYS_SYS . "/"); + define("PATH_DATA_SITE", PATH_DATA . "sites/" . config("sys_sys") . "/"); } $_SESSION['__sw__'] = ''; if (!$workspace->changeHashPassword($workspace->name, $response)) { diff --git a/workflow/engine/bin/tasks/cliUpgrade.php b/workflow/engine/bin/tasks/cliUpgrade.php index bfc449763..4a14d3424 100644 --- a/workflow/engine/bin/tasks/cliUpgrade.php +++ b/workflow/engine/bin/tasks/cliUpgrade.php @@ -134,10 +134,11 @@ function run_upgrade($command, $args) foreach ($workspaces as $index => $workspace) { if (!defined("SYS_SYS")) { define("SYS_SYS", $workspace->name); + config(["sys_sys" => $workspace->name]); } if (!defined("PATH_DATA_SITE")) { - define("PATH_DATA_SITE", PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP); + define("PATH_DATA_SITE", PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP); } if(!defined('DB_ADAPTER')) { diff --git a/workflow/engine/bin/tasks/cliWorkspaces.php b/workflow/engine/bin/tasks/cliWorkspaces.php index 6b5f216c9..b1a182ddf 100644 --- a/workflow/engine/bin/tasks/cliWorkspaces.php +++ b/workflow/engine/bin/tasks/cliWorkspaces.php @@ -360,10 +360,11 @@ function run_workspace_upgrade($args, $opts) try { if (!defined("SYS_SYS")) { define("SYS_SYS", $workspace->name); + config(["sys_sys" => $workspace->name]); } if (!defined("PATH_DATA_SITE")) { - define("PATH_DATA_SITE", PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP); + define("PATH_DATA_SITE", PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP); } $workspace->upgrade($buildCacheView, $workspace->name, false, $lang, ['updateXml' => $flagUpdateXml, 'updateMafe' => $first]); diff --git a/workflow/engine/bin/verify_solr.php b/workflow/engine/bin/verify_solr.php index 5cb5110ac..30d79a6e4 100644 --- a/workflow/engine/bin/verify_solr.php +++ b/workflow/engine/bin/verify_solr.php @@ -115,11 +115,12 @@ if (! defined ('SYS_SYS')) { if (file_exists (PATH_DB . $sObject . PATH_SEP . 'db.php')) { define ('SYS_SYS', $sObject); + config(["sys_sys" => $sObject]); // **************************************** // read initialize file require_once PATH_HOME . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'class.system.php'; - $config = System::getSystemConfiguration ('', '', SYS_SYS); + $config = System::getSystemConfiguration ('', '', config("sys_sys")); define ('MEMCACHED_ENABLED', $config ['memcached']); define ('MEMCACHED_SERVER', $config ['memcached_server']); define ('TIME_ZONE', $config ['time_zone']); @@ -142,7 +143,7 @@ if (! defined ('SYS_SYS')) { print "MEMCACHED_SERVER: " . $MEMCACHED_SERVER . "\n"; // ***************** PM Paths DATA ************************** - define ('PATH_DATA_SITE', PATH_DATA . 'sites/' . SYS_SYS . '/'); + define ('PATH_DATA_SITE', PATH_DATA . 'sites/' . config("sys_sys") . '/'); define ('PATH_DOCUMENT', PATH_DATA_SITE . 'files/'); define ('PATH_DATA_MAILTEMPLATES', PATH_DATA_SITE . 'mailTemplates/'); define ('PATH_DATA_PUBLIC', PATH_DATA_SITE . 'public/'); @@ -337,7 +338,7 @@ function displayMissingCases($aAppUidsDB, $aAppUidsSolr) function getListUids($usrUid, $action) { - if (($solrConf = System::solrEnv (SYS_SYS)) !== false) { + if (($solrConf = System::solrEnv (config("sys_sys"))) !== false) { print "Solr Configuration file: " . PATH_DATA_SITE . "env.ini\n"; print "solr_enabled: " . $solrConf ['solr_enabled'] . "\n"; diff --git a/workflow/engine/classes/ActionsByEmailCoreClass.php b/workflow/engine/classes/ActionsByEmailCoreClass.php index 88c11bafe..27e2fa1fe 100644 --- a/workflow/engine/classes/ActionsByEmailCoreClass.php +++ b/workflow/engine/classes/ActionsByEmailCoreClass.php @@ -160,7 +160,7 @@ class ActionsByEmailCoreClass extends PMPlugin if (!empty($envPort) && strpos($envHost, $envPort) === false) { $envHost = $envHost . $envPort; } - $link = (G::is_https() || $envProtocol ? 'https://' : 'http://') . $envHost . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . $envSkin . '/services/ActionsByEmail'; + $link = (G::is_https() || $envProtocol ? 'https://' : 'http://') . $envHost . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . $envSkin . '/services/ActionsByEmail'; switch ($configuration['ABE_TYPE']) { case 'CUSTOM': diff --git a/workflow/engine/classes/Applications.php b/workflow/engine/classes/Applications.php index 0d7b60e03..0d7f2b4d6 100644 --- a/workflow/engine/classes/Applications.php +++ b/workflow/engine/classes/Applications.php @@ -705,7 +705,7 @@ class Applications $tableName = implode( '', $newTableName ); // so the pm table class can be invoqued from the pm table model clases if (! class_exists( $tableName )) { - require_once (PATH_DB . SYS_SYS . PATH_SEP . "classes" . PATH_SEP . $tableName . ".php"); + require_once (PATH_DB . config("sys_sys") . PATH_SEP . "classes" . PATH_SEP . $tableName . ".php"); } } $totalCount = AppCacheViewPeer::doCount($CriteriaCount, $distinct); diff --git a/workflow/engine/classes/Cases.php b/workflow/engine/classes/Cases.php index df5b01b34..5f1b05de2 100644 --- a/workflow/engine/classes/Cases.php +++ b/workflow/engine/classes/Cases.php @@ -1068,7 +1068,7 @@ class Cases $oDerivation->verifyIsCaseChild($sAppUid); } } catch (Exception $e) { - Bootstrap::registerMonolog('DeleteCases', 200, 'Error in sub-process when trying to route a child case related to the case', ['application_uid' => $sAppUid, 'error' => $e->getMessage()], SYS_SYS, 'processmaker.log'); + Bootstrap::registerMonolog('DeleteCases', 200, 'Error in sub-process when trying to route a child case related to the case', ['application_uid' => $sAppUid, 'error' => $e->getMessage()], config("sys_sys"), 'processmaker.log'); } //Delete the registries in the table SUB_APPLICATION @@ -2211,7 +2211,7 @@ class Cases "delIndex" => $iDelIndex, "appInitDate" => $Fields['APP_INIT_DATE'] ]; - Bootstrap::registerMonolog('CreateCase', 200, "Create case", $data, SYS_SYS, 'processmaker.log'); + Bootstrap::registerMonolog('CreateCase', 200, "Create case", $data, config("sys_sys"), 'processmaker.log'); //call plugin if (class_exists('folderData')) { @@ -3375,7 +3375,7 @@ class Cases $oPMScript->setFields($aFields); /*----------------------------------********---------------------------------*/ - $cs = new CodeScanner(SYS_SYS); + $cs = new CodeScanner(config("sys_sys")); $strFoundDisabledCode = ""; /*----------------------------------********---------------------------------*/ diff --git a/workflow/engine/classes/ConsolidatedCases.php b/workflow/engine/classes/ConsolidatedCases.php index f3ffd8453..eba5139ba 100644 --- a/workflow/engine/classes/ConsolidatedCases.php +++ b/workflow/engine/classes/ConsolidatedCases.php @@ -146,7 +146,7 @@ class ConsolidatedCases } $sClassName = $TableName; - $sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP; + $sPath = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; @unlink($sPath . $sClassName . '.php'); @unlink($sPath . $sClassName . 'Peer.php'); diff --git a/workflow/engine/classes/Derivation.php b/workflow/engine/classes/Derivation.php index 8e5326f42..141ea89c1 100644 --- a/workflow/engine/classes/Derivation.php +++ b/workflow/engine/classes/Derivation.php @@ -856,7 +856,7 @@ class Derivation */ function derivate(array $currentDelegation, array $nextDelegations, $removeList = true) { - $this->sysSys = (defined("SYS_SYS"))? SYS_SYS : "Undefined"; + $this->sysSys = (defined("SYS_SYS"))? config("sys_sys") : "Undefined"; $this->context = Bootstrap::getDefaultContextLog(); $aContext = $this->context; $this->removeList = $removeList; diff --git a/workflow/engine/classes/EnterpriseClass.php b/workflow/engine/classes/EnterpriseClass.php index d09621f22..17f25c6e3 100644 --- a/workflow/engine/classes/EnterpriseClass.php +++ b/workflow/engine/classes/EnterpriseClass.php @@ -101,11 +101,11 @@ class EnterpriseClass extends PMPlugin { $oServerConf = &ServerConf::getSingleton(); $infoLicense =$oServerConf->getProperty('LICENSE_INFO'); - if (isset($infoLicense[SYS_SYS]['LIMIT_USERS'])) { + if (isset($infoLicense[config("sys_sys")]['LIMIT_USERS'])) { $criteria = new Criteria('workflow'); $criteria->add(UsersPeer::USR_STATUS, 'CLOSED', Criteria::NOT_EQUAL); $count = UsersPeer::doCount($criteria); - if ($count >= $infoLicense[SYS_SYS]['LIMIT_USERS'] ) { + if ($count >= $infoLicense[config("sys_sys")]['LIMIT_USERS'] ) { throw new Exception("You can\'t add more users to the System, this reach the limit of allowed users by license that it has installed now"); } } diff --git a/workflow/engine/classes/IndicatorsCalculator.php b/workflow/engine/classes/IndicatorsCalculator.php index d62e7b1f6..4f4732ff5 100644 --- a/workflow/engine/classes/IndicatorsCalculator.php +++ b/workflow/engine/classes/IndicatorsCalculator.php @@ -650,7 +650,7 @@ class IndicatorsCalculator } private function pdoConnection() { - $currentWS = defined('SYS_SYS') ? SYS_SYS : 'Wokspace Undefined'; + $currentWS = defined('SYS_SYS') ? config("sys_sys") : 'Wokspace Undefined'; $workSpace = new WorkspaceTools($currentWS); $arrayHost = explode(':', $workSpace->dbHost); $host = "host=".$arrayHost[0]; diff --git a/workflow/engine/classes/LdapAdvanced.php b/workflow/engine/classes/LdapAdvanced.php index 57a6fba15..fee97b462 100644 --- a/workflow/engine/classes/LdapAdvanced.php +++ b/workflow/engine/classes/LdapAdvanced.php @@ -470,7 +470,7 @@ class LdapAdvanced } //log format: date hour ipaddress workspace ldapErrorNr - fwrite($fpt, sprintf("%s %s %s %s %s \n", date("Y-m-d H:i:s"), getenv("REMOTE_ADDR"), SYS_SYS, $ldapErrorNr, $text)); + fwrite($fpt, sprintf("%s %s %s %s %s \n", date("Y-m-d H:i:s"), getenv("REMOTE_ADDR"), config("sys_sys"), $ldapErrorNr, $text)); fclose($fpt); } else { error_log("file $logFile is not writable "); diff --git a/workflow/engine/classes/PMLicensedFeatures.php b/workflow/engine/classes/PMLicensedFeatures.php index 0673c7be8..809346c6f 100644 --- a/workflow/engine/classes/PMLicensedFeatures.php +++ b/workflow/engine/classes/PMLicensedFeatures.php @@ -337,7 +337,7 @@ class PMLicensedFeatures /*----------------------------------********---------------------------------*/ public function verifyfeature ($featureName) { - $cached = Cache::get(PmLicenseManager::CACHE_KEY . '.' . SYS_SYS, []); + $cached = Cache::get(PmLicenseManager::CACHE_KEY . '.' . config("sys_sys"), []); if (isset($cached[$featureName])) { return $cached[$featureName]; } @@ -360,7 +360,7 @@ class PMLicensedFeatures $this->featuresDetails[$value[0]]->enabled = $enable; $cached[$featureName] = $enable; - Cache::put(PmLicenseManager::CACHE_KEY . '.' . SYS_SYS, $cached, Carbon::now()->addDay(1)); + Cache::put(PmLicenseManager::CACHE_KEY . '.' . config("sys_sys"), $cached, Carbon::now()->addDay(1)); return $enable; } diff --git a/workflow/engine/classes/PMPluginRegistry.php b/workflow/engine/classes/PMPluginRegistry.php index 6136b662a..8e88a9d94 100644 --- a/workflow/engine/classes/PMPluginRegistry.php +++ b/workflow/engine/classes/PMPluginRegistry.php @@ -1103,7 +1103,7 @@ class PMPluginRegistry try { $iPlugins = 0; $oServerConf = & ServerConf::getSingleton(); - $oServerConf->addPlugin( SYS_SYS, $this->_aPluginDetails ); + $oServerConf->addPlugin( config("sys_sys"), $this->_aPluginDetails ); foreach ($this->_aPluginDetails as $namespace => $detail) { if (isset( $detail->enabled ) && $detail->enabled) { if (! empty( $detail->sFilename ) && file_exists( $detail->sFilename )) { diff --git a/workflow/engine/classes/PmDrive.php b/workflow/engine/classes/PmDrive.php index 20cc3d455..ce45ba415 100644 --- a/workflow/engine/classes/PmDrive.php +++ b/workflow/engine/classes/PmDrive.php @@ -31,7 +31,7 @@ class PmDrive extends PmGoogleApi $this->folderIdPMDrive = empty($dataUser['USR_PMDRIVE_FOLDER_UID']) ? '' : $dataUser['USR_PMDRIVE_FOLDER_UID']; $conf = $this->getConfigGmail(); - $this->folderNamePMDrive = empty($conf->aConfig['folderNamePMDrive']) ? 'PMDrive (' . SYS_SYS . ')' : $conf->aConfig['folderNamePMDrive']; + $this->folderNamePMDrive = empty($conf->aConfig['folderNamePMDrive']) ? 'PMDrive (' . config("sys_sys") . ')' : $conf->aConfig['folderNamePMDrive']; if ($this->folderIdPMDrive == '') { $folderid = $this->createFolder($this->folderNamePMDrive); diff --git a/workflow/engine/classes/PmDynaform.php b/workflow/engine/classes/PmDynaform.php index 83bfbd01d..f139af765 100644 --- a/workflow/engine/classes/PmDynaform.php +++ b/workflow/engine/classes/PmDynaform.php @@ -35,7 +35,7 @@ class PmDynaform public function __construct($fields = array()) { - $this->sysSys = (defined("SYS_SYS")) ? SYS_SYS : "Undefined"; + $this->sysSys = (defined("SYS_SYS")) ? config("sys_sys") : "Undefined"; $this->context = \Bootstrap::getDefaultContextLog(); $this->dataSources = array("database", "dataVariable"); $this->pathRTLCss = '/lib/pmdynaform/build/css/PMDynaform-rtl.css'; @@ -1007,7 +1007,7 @@ class PmDynaform var app_uid = \"" . $this->fields["APP_UID"] . "\"; var prj_uid = \"" . $this->fields["PRO_UID"] . "\"; var step_mode = \"\"; - var workspace = \"" . SYS_SYS . "\"; + var workspace = \"" . config("sys_sys") . "\"; var credentials = " . G::json_encode($this->credentials) . "; var filePost = \"\"; var fieldsRequired = null; @@ -1068,7 +1068,7 @@ class PmDynaform "var app_uid = '" . $this->fields["APP_UID"] . "';\n" . "var prj_uid = '" . $this->fields["PRO_UID"] . "';\n" . "var step_mode = null;\n" . - "var workspace = '" . SYS_SYS . "';\n" . + "var workspace = '" . config("sys_sys") . "';\n" . "var credentials = " . G::json_encode($this->credentials) . ";\n" . "var filePost = null;\n" . "var fieldsRequired = null;\n" . @@ -1147,7 +1147,7 @@ class PmDynaform "var app_uid = '" . $this->fields["APP_UID"] . "';\n" . "var prj_uid = '" . $this->fields["PRO_UID"] . "';\n" . "var step_mode = '" . $this->fields["STEP_MODE"] . "';\n" . - "var workspace = '" . SYS_SYS . "';\n" . + "var workspace = '" . config("sys_sys") . "';\n" . "var credentials = " . G::json_encode($this->credentials) . ";\n" . "var filePost = null;\n" . "var fieldsRequired = null;\n" . @@ -1204,7 +1204,7 @@ class PmDynaform var app_uid = \"" . $this->fields["APP_UID"] . "\"; var prj_uid = \"" . $this->fields["PRO_UID"] . "\"; var step_mode = null; - var workspace = \"" . SYS_SYS . "\"; + var workspace = \"" . config("sys_sys") . "\"; var credentials = " . G::json_encode($this->credentials) . "; var filePost = \"cases_SaveDataSupervisor?UID=" . $this->fields["CURRENT_DYNAFORM"] . "\"; var fieldsRequired = null; @@ -1248,7 +1248,7 @@ class PmDynaform "var app_uid = null;\n" . "var prj_uid = '" . $this->record["PRO_UID"] . "';\n" . "var step_mode = null;\n" . - "var workspace = '" . SYS_SYS . "';\n" . + "var workspace = '" . config("sys_sys") . "';\n" . "var credentials = " . G::json_encode($this->credentials) . ";\n" . "var filePost = '" . $filename . "';\n" . "var fieldsRequired = " . G::json_encode(array()) . ";\n" . @@ -1290,7 +1290,7 @@ class PmDynaform "var app_uid = '" . G::decrypt($record['APP_UID'], URL_KEY) . "';\n" . "var prj_uid = '" . $this->record["PRO_UID"] . "';\n" . "var step_mode = null;\n" . - "var workspace = '" . SYS_SYS . "';\n" . + "var workspace = '" . config("sys_sys") . "';\n" . "var credentials = " . G::json_encode($this->credentials) . ";\n" . "var filePost = '" . $filename . "';\n" . "var fieldsRequired = " . G::json_encode(array()) . ";\n" . @@ -1354,7 +1354,7 @@ class PmDynaform "var app_uid = null;\n" . "var prj_uid = '" . $this->record["PRO_UID"] . "';\n" . "var step_mode = null;\n" . - "var workspace = '" . SYS_SYS . "';\n" . + "var workspace = '" . config("sys_sys") . "';\n" . "var credentials = " . G::json_encode($this->credentials) . ";\n" . "var fieldsRequired = " . G::json_encode(array()) . ";\n" . "var triggerDebug = null;\n" . @@ -2100,7 +2100,7 @@ class PmDynaform 400, 'JSON encoded string error ' . $jsonLastError . ': ' . $jsonLastErrorMsg, ['token' => $token, 'projectUid' => $this->record['PRO_UID'], 'dynaFormUid' => $this->record['DYN_UID']], - SYS_SYS, + config("sys_sys"), 'processmaker.log' ); } diff --git a/workflow/engine/classes/PmLicenseManager.php b/workflow/engine/classes/PmLicenseManager.php index 355142318..a36333588 100644 --- a/workflow/engine/classes/PmLicenseManager.php +++ b/workflow/engine/classes/PmLicenseManager.php @@ -26,11 +26,11 @@ class PmLicenseManager $activeLicenseSetting = $oServerConf->getProperty('ACTIVE_LICENSE'); - if ((isset($activeLicenseSetting[SYS_SYS])) && (file_exists($activeLicenseSetting[SYS_SYS]))) { - $licenseFile = $activeLicenseSetting[SYS_SYS]; + if ((isset($activeLicenseSetting[config("sys_sys")])) && (file_exists($activeLicenseSetting[config("sys_sys")]))) { + $licenseFile = $activeLicenseSetting[config("sys_sys")]; } else { $activeLicense = $this->getActiveLicense(); - $oServerConf->setProperty('ACTIVE_LICENSE', [SYS_SYS => $activeLicense['LICENSE_PATH']]); + $oServerConf->setProperty('ACTIVE_LICENSE', [config("sys_sys") => $activeLicense['LICENSE_PATH']]); $licenseFile = $activeLicense['LICENSE_PATH']; } @@ -103,14 +103,14 @@ class PmLicenseManager $licInfoA = $oServerConf->getProperty('LICENSE_INFO'); // The HUMAN attribute varies according to the timezone configured in the server, therefore it does not need // to be considered in the comparison if the value was changed or not, it is only comparing with te "timestamp" - if (isset($licInfoA[SYS_SYS]['date']['HUMAN'])) { - unset($licInfoA[SYS_SYS]['date']['HUMAN']); + if (isset($licInfoA[config("sys_sys")]['date']['HUMAN'])) { + unset($licInfoA[config("sys_sys")]['date']['HUMAN']); } } else { $licInfoA = []; } - if (empty($licInfoA[SYS_SYS]) || ($licInfoA[SYS_SYS] != $resultsRegister)) { - $licInfoA[SYS_SYS] = $resultsRegister; + if (empty($licInfoA[config("sys_sys")]) || ($licInfoA[config("sys_sys")] != $resultsRegister)) { + $licInfoA[config("sys_sys")] = $resultsRegister; $oServerConf->setProperty('LICENSE_INFO', $licInfoA); } } @@ -337,11 +337,11 @@ class PmLicenseManager } if (class_exists('pmTrialPlugin')) { - $linkText = $linkText . " "; + $linkText = $linkText . " "; } if (isset($_SESSION["__ENTERPRISE_SYSTEM_UPDATE__"]) && $_SESSION["__ENTERPRISE_SYSTEM_UPDATE__"] == 1) { - $aOnclick = "onclick=\"this.href='" . EnterpriseUtils::getUrlServerName() . "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/setup/main?s=PMENTERPRISE';\""; + $aOnclick = "onclick=\"this.href='" . EnterpriseUtils::getUrlServerName() . "/sys" . config("sys_sys") . "/" . SYS_LANG . "/" . SYS_SKIN . "/setup/main?s=PMENTERPRISE';\""; if (EnterpriseUtils::skinIsUx() == 1) { $aOnclick = "onclick=\"Ext.ComponentMgr.get('mainTabPanel').setActiveTab('pm-option-setup'); Ext.ComponentMgr.get('pm-option-setup').setLocation(Ext.ComponentMgr.get('pm-option-setup').defaultSrc + 's=PMENTERPRISE', true); return (false);\""; } @@ -385,7 +385,7 @@ class PmLicenseManager } else { $oServerConf = &ServerConf::getSingleton(); - $oServerConf->setProperty('ACTIVE_LICENSE', [SYS_SYS => $path]); + $oServerConf->setProperty('ACTIVE_LICENSE', [config("sys_sys") => $path]); $this->saveDataLicense($results, $path, $redirect); if ($redirect) { G::Header('location: ../enterprise/addonsStore'); @@ -482,7 +482,7 @@ class PmLicenseManager $tr->setLicenseType($LicenseType); $res = $tr->save(); - Cache::forget(PmLicenseManager::CACHE_KEY . '.' . SYS_SYS); + Cache::forget(PmLicenseManager::CACHE_KEY . '.' . config("sys_sys")); } catch (Exception $e) { G::pr($e); } diff --git a/workflow/engine/classes/PmTable.php b/workflow/engine/classes/PmTable.php index e0c592910..dd4a36e0b 100644 --- a/workflow/engine/classes/PmTable.php +++ b/workflow/engine/classes/PmTable.php @@ -212,7 +212,7 @@ class PmTable } $this->schemaFilename = 'schema.xml'; - $this->baseDir = PATH_DB . SYS_SYS . PATH_SEP; + $this->baseDir = PATH_DB . config("sys_sys") . PATH_SEP; $this->targetDir = $this->baseDir . 'pmt-propel' . PATH_SEP . $this->dataSource . PATH_SEP; $this->configDir = $this->targetDir . 'config' . PATH_SEP; $this->dataDir = $this->targetDir . 'data' . PATH_SEP; diff --git a/workflow/engine/classes/ProcessMap.php b/workflow/engine/classes/ProcessMap.php index 798e7e893..db3cafed0 100644 --- a/workflow/engine/classes/ProcessMap.php +++ b/workflow/engine/classes/ProcessMap.php @@ -2755,7 +2755,7 @@ class ProcessMap $http = 'http://'; } - $link = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $sProcessUID . '/'; + $link = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $sProcessUID . '/'; $row = array(); $c = 0; @@ -2767,8 +2767,8 @@ class ProcessMap $TaskFields['TAS_ASSIGN_TYPE'] = ''; $row[] = array('W_TITLE' => '', 'W_DELETE' => '', 'TAS_ASSIGN_TYPE' => $TaskFields['TAS_ASSIGN_TYPE'] ); - if (is_dir(PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $sProcessUID)) { - $dir = opendir(PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $sProcessUID); + if (is_dir(PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP . "public" . PATH_SEP . $sProcessUID)) { + $dir = opendir(PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP . "public" . PATH_SEP . $sProcessUID); while ($archivo = readdir($dir)) { //print $archivo." ****
"; if ($archivo != '.') { @@ -3115,7 +3115,7 @@ class ProcessMap public function listNoProcessesUser($sProcessUID) { - $memcache = & PMmemcached::getSingleton(SYS_SYS); + $memcache = & PMmemcached::getSingleton(config("sys_sys")); $oCriteria = new Criteria('workflow'); $oCriteria->addSelectColumn(ProcessUserPeer::USR_UID); @@ -4777,7 +4777,7 @@ class ProcessMap $http = 'http://'; } - $link = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $sProcessUID . '/'; + $link = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $sProcessUID . '/'; $row = array(); $c = 0; @@ -4790,8 +4790,8 @@ class ProcessMap //$row [] = array ('W_TITLE' => '', 'W_DELETE' => '', 'TAS_ASSIGN_TYPE' => $TaskFields ['TAS_ASSIGN_TYPE'] ); - if (is_dir(PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $sProcessUID)) { - $dir = opendir(PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $sProcessUID); + if (is_dir(PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP . "public" . PATH_SEP . $sProcessUID)) { + $dir = opendir(PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP . "public" . PATH_SEP . $sProcessUID); $dynTitle = str_replace(' ', '_', str_replace('/', '_', $dynTitle)); $arlink = $link . $dynTitle . '.php'; //$arlink = "" . $alink . ""; @@ -5812,7 +5812,7 @@ class ProcessMap public function listExtNoProcessesUser($sProcessUID) { - $memcache = & PMmemcached::getSingleton(SYS_SYS); + $memcache = & PMmemcached::getSingleton(config("sys_sys")); $oCriteria = new Criteria('workflow'); $oCriteria->addSelectColumn(ProcessUserPeer::USR_UID); diff --git a/workflow/engine/classes/Processes.php b/workflow/engine/classes/Processes.php index acb3056a9..68adc605e 100644 --- a/workflow/engine/classes/Processes.php +++ b/workflow/engine/classes/Processes.php @@ -4131,7 +4131,7 @@ class Processes try { $result = $scriptTask->create($processUid, $record); } catch (Exception $e) { - Bootstrap::registerMonolog('DataError', 400, $e->getMessage(), $record, SYS_SYS, 'processmaker.log'); + Bootstrap::registerMonolog('DataError', 400, $e->getMessage(), $record, config("sys_sys"), 'processmaker.log'); } } } catch (Exception $e) { @@ -4499,7 +4499,7 @@ class Processes $proTitle = (substr(G::inflect($data->process['PRO_TITLE']), 0, 245)); $proTitle = preg_replace("/[^A-Za-z0-9_]/", "", $proTitle); //Calculating the maximum length of file name - $pathLength = strlen(PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP); + $pathLength = strlen(PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP); $length = strlen($proTitle) + $pathLength; $limit = 200; if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { @@ -4578,7 +4578,7 @@ class Processes // for mailtemplates files - $MAILS_ROOT_PATH = PATH_DATA . 'sites' . PATH_SEP . SYS_SYS . PATH_SEP . 'mailTemplates' . PATH_SEP . $data->process['PRO_UID']; + $MAILS_ROOT_PATH = PATH_DATA . 'sites' . PATH_SEP . config("sys_sys") . PATH_SEP . 'mailTemplates' . PATH_SEP . $data->process['PRO_UID']; $isMailTempSent = false; $isPublicSent = false; @@ -4615,7 +4615,7 @@ class Processes } // for public files - $PUBLIC_ROOT_PATH = PATH_DATA . 'sites' . PATH_SEP . SYS_SYS . PATH_SEP . 'public' . PATH_SEP . $data->process['PRO_UID']; + $PUBLIC_ROOT_PATH = PATH_DATA . 'sites' . PATH_SEP . config("sys_sys") . PATH_SEP . 'public' . PATH_SEP . $data->process['PRO_UID']; //Get WebEntry file names $arrayWebEntryFile = array(); @@ -4671,7 +4671,7 @@ class Processes /* // for public files - $PUBLIC_ROOT_PATH = PATH_DATA.'sites'.PATH_SEP.SYS_SYS.PATH_SEP.'public'.PATH_SEP.$data->process['PRO_UID']; + $PUBLIC_ROOT_PATH = PATH_DATA.'sites'.PATH_SEP.config("sys_sys").PATH_SEP.'public'.PATH_SEP.$data->process['PRO_UID']; //if this process have any mailfile if ( is_dir( $PUBLIC_ROOT_PATH ) ) { //get mail files list from this directory @@ -5067,7 +5067,7 @@ class Processes $context['url'] = SYS_CURRENT_URI . '?' . SYS_CURRENT_PARMS; } $context['usrUid'] = isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : ''; - $sysSys = defined("SYS_SYS") ? SYS_SYS : "Undefined"; + $sysSys = defined("SYS_SYS") ? config("sys_sys") : "Undefined"; $message = 'The imported template has a number of byes different than the original template, please verify if the file \'' . $newFileName . '\' is correct.'; $level = 400; Bootstrap::registerMonolog($channel, $level, $message, $context, $sysSys, 'processmaker.log'); @@ -6079,7 +6079,7 @@ class Processes } //Set variables - $cs = new CodeScanner((!is_null($workspaceName))? $workspaceName : SYS_SYS); + $cs = new CodeScanner((!is_null($workspaceName))? $workspaceName : config("sys_sys")); $delimiter = DBAdapter::getStringDelimiter(); diff --git a/workflow/engine/classes/ReportTables.php b/workflow/engine/classes/ReportTables.php index fe424dad3..fecd0ba6e 100644 --- a/workflow/engine/classes/ReportTables.php +++ b/workflow/engine/classes/ReportTables.php @@ -605,7 +605,7 @@ class ReportTables try { $rs = $stmt->executeQuery($sQuery); } catch (Exception $e) { - Bootstrap::registerMonolog('sqlExecution', 400, 'Sql Execution', ['sql' => $sQuery,'error' => $e->getMessage()], SYS_SYS, 'processmaker.log'); + Bootstrap::registerMonolog('sqlExecution', 400, 'Sql Execution', ['sql' => $sQuery,'error' => $e->getMessage()], config("sys_sys"), 'processmaker.log'); } } @@ -644,7 +644,7 @@ class ReportTables try { $rs = $stmt->executeQuery($sQuery); } catch (Exception $e) { - Bootstrap::registerMonolog('sqlExecution', 400, 'Sql Execution', ['sql' => $sQuery,'error' => $e->getMessage()], SYS_SYS, 'processmaker.log'); + Bootstrap::registerMonolog('sqlExecution', 400, 'Sql Execution', ['sql' => $sQuery,'error' => $e->getMessage()], config("sys_sys"), 'processmaker.log'); } } } else { diff --git a/workflow/engine/classes/ServerConf.php b/workflow/engine/classes/ServerConf.php index a5cb68e6b..166527f48 100644 --- a/workflow/engine/classes/ServerConf.php +++ b/workflow/engine/classes/ServerConf.php @@ -152,12 +152,12 @@ class ServerConf public function sucessfulLogin() { $this->logins++; - if (isset($this->workspaces[SYS_SYS]) && isset($this->workspaces[SYS_SYS]['WSP_LOGINS'])) { - $this->workspaces[SYS_SYS]['WSP_LOGINS']++; + if (isset($this->workspaces[config("sys_sys")]) && isset($this->workspaces[config("sys_sys")]['WSP_LOGINS'])) { + $this->workspaces[config("sys_sys")]['WSP_LOGINS']++; } - if (isset($this->workspaces[SYS_SYS]) && !isset($this->workspaces[SYS_SYS]['WSP_LOGINS'])) { - $this->workspaces[SYS_SYS]['WSP_LOGINS'] = 1; + if (isset($this->workspaces[config("sys_sys")]) && !isset($this->workspaces[config("sys_sys")]['WSP_LOGINS'])) { + $this->workspaces[config("sys_sys")]['WSP_LOGINS'] = 1; } $this->saveSingleton(); diff --git a/workflow/engine/classes/Upgrade.php b/workflow/engine/classes/Upgrade.php index 2721186ec..c65ef8937 100644 --- a/workflow/engine/classes/Upgrade.php +++ b/workflow/engine/classes/Upgrade.php @@ -100,7 +100,7 @@ class Upgrade try { $num += 1; printf("Upgrading workspaces ($num/$count): {$workspace->name}\n"); - $workspace->upgrade(false, SYS_SYS, false, 'en', ['updateXml' => $first, 'updateMafe' => $first]); + $workspace->upgrade(false, config("sys_sys"), false, 'en', ['updateXml' => $first, 'updateMafe' => $first]); $workspace->close(); $first = false; } catch (Exception $e) { diff --git a/workflow/engine/classes/WorkspaceTools.php b/workflow/engine/classes/WorkspaceTools.php index 6edfc8bce..f5dd94e74 100644 --- a/workflow/engine/classes/WorkspaceTools.php +++ b/workflow/engine/classes/WorkspaceTools.php @@ -99,8 +99,11 @@ class WorkspaceTools * * @return void */ - public function upgrade($buildCacheView = false, $workSpace = SYS_SYS, $onedb = false, $lang = 'en', array $arrayOptTranslation = null) + public function upgrade($buildCacheView = false, $workSpace = null, $onedb = false, $lang = 'en', array $arrayOptTranslation = null) { + if ($workSpace === null) { + $workSpace = config("sys_sys"); + } if (is_null($arrayOptTranslation)) { $arrayOptTranslation = ['updateXml' => true, 'updateMafe' => true]; } @@ -220,8 +223,11 @@ class WorkspaceTools * Updating cases directories structure * */ - public function updateStructureDirectories($workSpace = SYS_SYS) + public function updateStructureDirectories($workSpace = null) { + if ($workSpace === null) { + $workSpace = config("sys_sys"); + } $start = microtime(true); CLI::logging("> Updating cases directories structure...\n"); $this->upgradeCasesDirectoryStructure($workSpace); @@ -470,8 +476,11 @@ class WorkspaceTools /** * Upgrade this workspace Content. */ - public function upgradeContent($workSpace = SYS_SYS) + public function upgradeContent($workSpace = null) { + if ($workSpace === null) { + $workSpace = config("sys_sys"); + } $this->initPropel(true); //require_once 'classes/model/Translation.php'; $translation = new Translation(); @@ -1741,10 +1750,11 @@ class WorkspaceTools //Restore if (!defined("SYS_SYS")) { define("SYS_SYS", $workspaceName); + config(["sys_sys" => $workspaceName]); } if (!defined("PATH_DATA_SITE")) { - define("PATH_DATA_SITE", PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP); + define("PATH_DATA_SITE", PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP); } $pmVersionWorkspaceToRestore = (preg_match("/^([\d\.]+).*$/", $metadata->PM_VERSION, $arrayMatch)) ? $arrayMatch[1] : ""; @@ -3937,8 +3947,11 @@ class WorkspaceTools * Updating framework directory structure * */ - private function updateFrameworkPaths($workSpace = SYS_SYS) + private function updateFrameworkPaths($workSpace = null) { + if ($workSpace === null) { + $workSpace = config("sys_sys"); + } $paths = [ PATH_DATA.'framework' => 0770, PATH_DATA.'framework' . DIRECTORY_SEPARATOR . 'cache' => 0770, diff --git a/workflow/engine/classes/class.pmFunctions.php b/workflow/engine/classes/class.pmFunctions.php index 14f5896b9..3f1b998dd 100644 --- a/workflow/engine/classes/class.pmFunctions.php +++ b/workflow/engine/classes/class.pmFunctions.php @@ -239,7 +239,7 @@ function literalDate ($date, $lang = 'en') */ function executeQuery ($SqlStatement, $DBConnectionUID = 'workflow', $aParameter = array()) { - $sysSys = (defined("SYS_SYS"))? SYS_SYS : "Undefined"; + $sysSys = (defined("SYS_SYS"))? config("sys_sys") : "Undefined"; $aContext = \Bootstrap::getDefaultContextLog(); $con = Propel::getConnection( $DBConnectionUID ); $con->begin(); @@ -537,7 +537,7 @@ function WSOpen ($force = false) ); if (! isset( $_SESSION["WS_END_POINT"] )) { - $defaultEndpoint = $_SERVER["REQUEST_SCHEME"] . "://" . $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . "/sys" . SYS_SYS . "/en/classic/services/wsdl2"; + $defaultEndpoint = $_SERVER["REQUEST_SCHEME"] . "://" . $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . "/sys" . config("sys_sys") . "/en/classic/services/wsdl2"; } $endpoint = isset( $_SESSION["WS_END_POINT"] ) ? $_SESSION["WS_END_POINT"] : $defaultEndpoint; @@ -3455,7 +3455,7 @@ function PMFCaseLink($caseUid, $workspace = null, $language = null, $skin = null if ($arrayApplicationData === false) { return false; } - $workspace = (!empty($workspace)) ? $workspace : SYS_SYS; + $workspace = (!empty($workspace)) ? $workspace : config("sys_sys"); $language = (!empty($language)) ? $language : SYS_LANG; $skin = (!empty($skin)) ? $skin : SYS_SKIN; diff --git a/workflow/engine/classes/class.pmScript.php b/workflow/engine/classes/class.pmScript.php index 6e786a1aa..37fc7f510 100644 --- a/workflow/engine/classes/class.pmScript.php +++ b/workflow/engine/classes/class.pmScript.php @@ -46,7 +46,7 @@ use ProcessMaker\Plugins\PluginRegistry; function __autoload ($sClassName) { if (defined( 'SYS_SYS' )) { - $sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP; + $sPath = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; if (file_exists( $sPath . $sClassName . '.php' )) { require_once $sPath . $sClassName . '.php'; } @@ -54,7 +54,7 @@ function __autoload ($sClassName) } if (defined('SYS_SYS') && (!defined('PATH_DATA_SITE') || !defined('PATH_WORKSPACE'))) { - Bootstrap::setConstantsRelatedWs(SYS_SYS); + Bootstrap::setConstantsRelatedWs(config("sys_sys")); } //Add External Triggers diff --git a/workflow/engine/classes/class.webdav.php b/workflow/engine/classes/class.webdav.php index 9f509d560..cfa5a6bff 100644 --- a/workflow/engine/classes/class.webdav.php +++ b/workflow/engine/classes/class.webdav.php @@ -39,7 +39,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server public function ServeRequest($base = false) { //$this->base = '/'; - $this->uriBase = '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/webdav/'; + $this->uriBase = '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/webdav/'; // let the base class do all the work parent::ServeRequest(); @@ -72,7 +72,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server // prepare property array $files["files"] = array(); - $pathClasses = PATH_DB . PATH_SEP . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP; + $pathClasses = PATH_DB . PATH_SEP . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; if (count($paths) == 0 && is_dir($pathClasses)) { $props = array(); $props[] = $this->mkprop("displayname", 'Classes'); @@ -110,7 +110,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server } //path classes - $pathProcesses = PATH_DB . SYS_SYS . PATH_SEP; + $pathProcesses = PATH_DB . config("sys_sys") . PATH_SEP; if (count($paths) == 0 && is_dir($pathProcesses)) { $props = array(); $props[] = $this->mkprop("displayname", 'Processes'); @@ -404,7 +404,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server $options = $filter->xssFilterHard($options); $paths = $filter->xssFilterHard($this->paths); - $pathClasses = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP; + $pathClasses = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; if (count($paths) > 0 && $paths[0] == 'classes' && is_dir($pathClasses)) { $fsFile = $pathClasses . $paths[1]; $fsFile = $filter->xssFilterHard($fsFile); @@ -419,7 +419,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server } } - $pathProcesses = PATH_DB . SYS_SYS . PATH_SEP; + $pathProcesses = PATH_DB . config("sys_sys") . PATH_SEP; if (count($paths) > 0 && $paths[0] == 'processes' && is_dir($pathProcesses)) { if (count($paths) == 4 && $paths[2] == 'xmlforms') { $pathXmlform = $pathProcesses . 'xmlForms' . PATH_SEP . $paths[1] . PATH_SEP; @@ -636,7 +636,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server } } - $pathProcesses = PATH_DB . SYS_SYS . PATH_SEP; + $pathProcesses = PATH_DB . config("sys_sys") . PATH_SEP; if (count($paths) > 0 && $paths[0] == 'processes' && is_dir($pathProcesses)) { if ($paths[2] == 'xmlforms') { $pathTemplates = $pathProcesses . 'xmlForms' . PATH_SEP . $paths[1] . PATH_SEP; diff --git a/workflow/engine/classes/model/AdditionalTables.php b/workflow/engine/classes/model/AdditionalTables.php index 0f22d1c55..f2f3f30b5 100644 --- a/workflow/engine/classes/model/AdditionalTables.php +++ b/workflow/engine/classes/model/AdditionalTables.php @@ -332,7 +332,7 @@ class AdditionalTables extends BaseAdditionalTables { try { $aData = $this->load($sUID, true); - $sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP; + $sPath = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; $sClassName = ($aData['ADD_TAB_CLASS_NAME'] != '' ? $aData['ADD_TAB_CLASS_NAME'] : $this->getPHPName($aData['ADD_TAB_NAME'])); @@ -383,7 +383,7 @@ class AdditionalTables extends BaseAdditionalTables $_SESSION["PROCESS"] = $aData['PRO_UID']; } $aData['DBS_UID'] = $aData['DBS_UID'] ? $aData['DBS_UID'] : 'workflow'; - $sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP; + $sPath = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; $sClassName = ($aData['ADD_TAB_CLASS_NAME'] != '' ? $aData['ADD_TAB_CLASS_NAME'] : $this->getPHPName($aData['ADD_TAB_NAME'])); @@ -531,7 +531,7 @@ class AdditionalTables extends BaseAdditionalTables { try { $aData = $this->load($sUID, true); - $sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP; + $sPath = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; $sClassName = ($aData['ADD_TAB_CLASS_NAME'] != '' ? $aData['ADD_TAB_CLASS_NAME'] : $this->getPHPName($aData['ADD_TAB_NAME'])); @@ -550,7 +550,7 @@ class AdditionalTables extends BaseAdditionalTables { try { $aData = $this->load($sUID, true); - $sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP; + $sPath = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; $sClassName = ($aData['ADD_TAB_CLASS_NAME'] != '' ? $aData['ADD_TAB_CLASS_NAME'] : $this->getPHPName($aData['ADD_TAB_NAME'])); @@ -604,7 +604,7 @@ class AdditionalTables extends BaseAdditionalTables { try { $aData = $this->load($sUID, true); - $sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP; + $sPath = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; $sClassName = ($aData['ADD_TAB_CLASS_NAME'] != '' ? $aData['ADD_TAB_CLASS_NAME'] : $this->getPHPName($aData['ADD_TAB_NAME'])); @@ -632,7 +632,7 @@ class AdditionalTables extends BaseAdditionalTables try { //$sPMUID = $aFields['PM_UNIQUE_ID']; $aData = $this->load($sUID, true); - $sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP; + $sPath = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; $sClassName = ($aData['ADD_TAB_CLASS_NAME'] != '' ? $aData['ADD_TAB_CLASS_NAME'] : $this->getPHPName($aData['ADD_TAB_NAME'])); @@ -679,7 +679,7 @@ class AdditionalTables extends BaseAdditionalTables { try { $aData = $this->load($sUID, true); - $sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP; + $sPath = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; $sClassName = ($aData['ADD_TAB_CLASS_NAME'] != '' ? $aData['ADD_TAB_CLASS_NAME'] : $this->getPHPName($aData['ADD_TAB_NAME'])); @@ -1159,7 +1159,7 @@ class AdditionalTables extends BaseAdditionalTables $sClassName = $this->getPHPName($sTableName); } - $sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP; + $sPath = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; if (!file_exists($sPath)) { G::mk_dir($sPath); } diff --git a/workflow/engine/classes/model/AddonsStore.php b/workflow/engine/classes/model/AddonsStore.php index 06eefcd05..c4d7e3b99 100644 --- a/workflow/engine/classes/model/AddonsStore.php +++ b/workflow/engine/classes/model/AddonsStore.php @@ -367,7 +367,7 @@ class AddonsStore extends BaseAddonsStore $sStatus = $oDetails->isEnabled() ? G::LoadTranslation('ID_ENABLED') : G::LoadTranslation('ID_DISABLED'); if ($oDetails->getWorkspaces()) { - if (!in_array(SYS_SYS, $oDetails->getWorkspaces())) { + if (!in_array(config("sys_sys"), $oDetails->getWorkspaces())) { continue; } } diff --git a/workflow/engine/classes/model/CaseScheduler.php b/workflow/engine/classes/model/CaseScheduler.php index a5577b78d..ffc7735d9 100644 --- a/workflow/engine/classes/model/CaseScheduler.php +++ b/workflow/engine/classes/model/CaseScheduler.php @@ -332,7 +332,7 @@ class CaseScheduler extends BaseCaseScheduler } } - $url = SERVER_NAME . $port . "/sys" . SYS_SYS . "/" . SYS_LANG . "/classic/services/wsdl2"; + $url = SERVER_NAME . $port . "/sys" . config("sys_sys") . "/" . SYS_LANG . "/classic/services/wsdl2"; $testConnection = true; try { diff --git a/workflow/engine/classes/model/Content.php b/workflow/engine/classes/model/Content.php index 900b12d6d..061b2f3e2 100644 --- a/workflow/engine/classes/model/Content.php +++ b/workflow/engine/classes/model/Content.php @@ -312,8 +312,11 @@ class Content extends BaseContent * * @param array $langs */ - public function regenerateContent ($langs, $workSpace = SYS_SYS) + public function regenerateContent ($langs, $workSpace = null) { + if ($workSpace === null) { + $workSpace = config("sys_sys"); + } //Search the language $key = array_search( 'en', $langs ); if ($key === false) { diff --git a/workflow/engine/classes/model/Process.php b/workflow/engine/classes/model/Process.php index 9e772037a..9f5f38b23 100644 --- a/workflow/engine/classes/model/Process.php +++ b/workflow/engine/classes/model/Process.php @@ -739,7 +739,7 @@ class Process extends BaseProcess } - $memcache = & PMmemcached::getSingleton( SYS_SYS ); + $memcache = & PMmemcached::getSingleton( config("sys_sys") ); if (isset($memcache) && $memcache->enabled == 1 ) { return $aProcesses; } @@ -766,7 +766,7 @@ class Process extends BaseProcess GROUP BY PRO_UID, APP_STATUS*/ require_once 'classes/model/Application.php'; - $memcache = & PMmemcached::getSingleton( SYS_SYS ); + $memcache = & PMmemcached::getSingleton( config("sys_sys") ); $memkey = 'getCasesCountInAllProcesses'; if (($aProcesses = $memcache->get( $memkey )) === false) { $oCriteria = new Criteria( 'workflow' ); @@ -877,7 +877,7 @@ class Process extends BaseProcess $limit = 25; $start = 0; - $memcache = PMmemcached::getSingleton( SYS_SYS ); + $memcache = PMmemcached::getSingleton( config("sys_sys") ); for ($start = 0; $start <= 50 - 1; $start ++) { $memkey = "processList-allProcesses-" . ($start * $limit) . "-" . $limit; diff --git a/workflow/engine/classes/model/UsersProperties.php b/workflow/engine/classes/model/UsersProperties.php index b4e55a196..cf3b417a0 100644 --- a/workflow/engine/classes/model/UsersProperties.php +++ b/workflow/engine/classes/model/UsersProperties.php @@ -258,10 +258,10 @@ class UsersProperties extends BaseUsersProperties $url = $this->_getDefaultLocation(); return $url; } else { - $url = '/sys' . SYS_SYS . '/' . $this->lang . '/' . $_COOKIE['workspaceSkin'] . '/main'; + $url = '/sys' . config("sys_sys") . '/' . $this->lang . '/' . $_COOKIE['workspaceSkin'] . '/main'; } } else { - $url = '/sys' . SYS_SYS . '/' . $this->lang . '/' . SYS_SKIN . '/main'; + $url = '/sys' . config("sys_sys") . '/' . $this->lang . '/' . SYS_SKIN . '/main'; } global $RBAC; $oConf = new Configurations(); @@ -330,9 +330,9 @@ class UsersProperties extends BaseUsersProperties $pathMethod = $detail->getPathMethod(); if (isset($pathMethod) && $detail->equalRoleCodeTo($userRole)) { if (isset($_COOKIE['workspaceSkin'])) { - $url = '/sys' . SYS_SYS . '/' . $this->lang . '/' . $_COOKIE['workspaceSkin'] . '/' . $pathMethod; + $url = '/sys' . config("sys_sys") . '/' . $this->lang . '/' . $_COOKIE['workspaceSkin'] . '/' . $pathMethod; } else { - $url = '/sys' . SYS_SYS . '/' . $this->lang . '/' . SYS_SKIN . '/' . $pathMethod; + $url = '/sys' . config("sys_sys") . '/' . $this->lang . '/' . SYS_SKIN . '/' . $pathMethod; } } } @@ -376,7 +376,7 @@ class UsersProperties extends BaseUsersProperties case 'SINGLE': $_SESSION['user_experience'] = $uxType; $_SESSION['user_last_skin'] = SYS_SKIN; - $url = '/sys' . SYS_SYS . '/' . $this->lang . '/uxs/' . 'home'; + $url = '/sys' . config("sys_sys") . '/' . $this->lang . '/uxs/' . 'home'; break; } @@ -393,11 +393,11 @@ class UsersProperties extends BaseUsersProperties $oConf = new Configurations(); $oConf->loadConfig( $x, 'USER_PREFERENCES', '', '', $_SESSION['USER_LOGGED'], '' ); - //$baseUrl = '/sys' . SYS_SYS . '/' . $this->lang . '/' . SYS_SKIN . '/'; + //$baseUrl = '/sys' . config("sys_sys") . '/' . $this->lang . '/' . SYS_SKIN . '/'; if (isset($_COOKIE['workspaceSkin'])) { - $baseUrl = '/sys' . SYS_SYS . '/' . $this->lang . '/' . $_COOKIE['workspaceSkin'] . '/'; + $baseUrl = '/sys' . config("sys_sys") . '/' . $this->lang . '/' . $_COOKIE['workspaceSkin'] . '/'; } else { - $baseUrl = '/sys' . SYS_SYS . '/' . $this->lang . '/' . SYS_SKIN . '/'; + $baseUrl = '/sys' . config("sys_sys") . '/' . $this->lang . '/' . SYS_SKIN . '/'; } $url = ''; diff --git a/workflow/engine/config/databases.php b/workflow/engine/config/databases.php index b15d65731..c27df9f39 100644 --- a/workflow/engine/config/databases.php +++ b/workflow/engine/config/databases.php @@ -25,10 +25,10 @@ if (defined('PATH_DB') && defined('SYS_SYS')) { - if (!file_exists(PATH_DB . SYS_SYS . '/db.php')) - throw new Exception("Could not find db.php in current workspace " . SYS_SYS); + if (!file_exists(PATH_DB . config("sys_sys") . '/db.php')) + throw new Exception("Could not find db.php in current workspace " . config("sys_sys")); - require_once(PATH_DB . SYS_SYS . '/db.php'); + require_once(PATH_DB . config("sys_sys") . '/db.php'); //to do: enable for other databases $dbType = DB_ADAPTER; $dsn = DB_ADAPTER . '://' . DB_USER . ':' . urlencode(DB_PASS) . '@' . DB_HOST . '/' . DB_NAME; diff --git a/workflow/engine/controllers/admin.php b/workflow/engine/controllers/admin.php index aa87d89ca..a0acc87f9 100644 --- a/workflow/engine/controllers/admin.php +++ b/workflow/engine/controllers/admin.php @@ -314,7 +314,7 @@ class Admin extends Controller ); } - $properties[] = array ( G::LoadTranslation('ID_WORKSPACE') ,defined( "SYS_SYS" ) ? SYS_SYS : "Not defined",$pmSection + $properties[] = array ( G::LoadTranslation('ID_WORKSPACE') ,defined( "SYS_SYS" ) ? config("sys_sys") : "Not defined",$pmSection ); $properties[] = array ( G::LoadTranslation('ID_SERVER_PROTOCOL') ,getenv( 'SERVER_PROTOCOL' ),$sysSection diff --git a/workflow/engine/controllers/adminProxy.php b/workflow/engine/controllers/adminProxy.php index e1a5e54c7..8cb7dd34a 100644 --- a/workflow/engine/controllers/adminProxy.php +++ b/workflow/engine/controllers/adminProxy.php @@ -117,7 +117,7 @@ class adminProxy extends HttpProxyController $this->success = true; $this->restart = $restart; - $this->url = "/sys" . SYS_SYS . "/" . (($sysConf["default_lang"] != "")? $sysConf["default_lang"] : ((defined("SYS_LANG") && SYS_LANG != "")? SYS_LANG : "en")) . "/" . $sysConf["default_skin"] . $urlPart; + $this->url = "/sys" . config("sys_sys") . "/" . (($sysConf["default_lang"] != "")? $sysConf["default_lang"] : ((defined("SYS_LANG") && SYS_LANG != "")? SYS_LANG : "en")) . "/" . $sysConf["default_skin"] . $urlPart; $this->message = 'Saved Successfully'; $msg = ""; if ($httpData->proxy_host != '' || $httpData->proxy_port != '' || $httpData->proxy_user != '') { @@ -1191,7 +1191,7 @@ class adminProxy extends HttpProxyController $snameLogo = self::changeNamelogo($snameLogo); $oConf = new Configurations; $aConf = Array( - 'WORKSPACE_LOGO_NAME' => SYS_SYS, + 'WORKSPACE_LOGO_NAME' => config("sys_sys"), 'DEFAULT_LOGO_NAME' => $snameLogo ); @@ -1356,7 +1356,7 @@ class adminProxy extends HttpProxyController '%s://%s/sys%s/%s/%s/oauth2/grant', $http, $host, - SYS_SYS, + config("sys_sys"), $lang, SYS_SKIN ); @@ -1416,7 +1416,7 @@ class adminProxy extends HttpProxyController //On premise or cloud $licInfo = $oServerConf->getProperty( 'LICENSE_INFO' ); - $params['lt'] = isset($licInfo[SYS_SYS]) ? isset($licInfo[SYS_SYS]['TYPE'])? $licInfo[SYS_SYS]['TYPE'] : '' : ''; + $params['lt'] = isset($licInfo[config("sys_sys")]) ? isset($licInfo[config("sys_sys")]['TYPE'])? $licInfo[config("sys_sys")]['TYPE'] : '' : ''; //ProcessMaker Version $params['v'] = System::getVersion(); @@ -1511,7 +1511,7 @@ class adminProxy extends HttpProxyController $params['t'] = (defined('TIME_ZONE') && TIME_ZONE != "Unknown") ? TIME_ZONE : date_default_timezone_get(); $params['w'] = count(System::listWorkspaces()); - $support = PATH_DATA_SITE . G::sanitizeString($licenseManager->info['FIRST_NAME'] . '-' . $licenseManager->info['LAST_NAME'] . '-' . SYS_SYS . '-' . date('YmdHis'), false, false) . '.spm'; + $support = PATH_DATA_SITE . G::sanitizeString($licenseManager->info['FIRST_NAME'] . '-' . $licenseManager->info['LAST_NAME'] . '-' . config("sys_sys") . '-' . date('YmdHis'), false, false) . '.spm'; file_put_contents($support, serialize($params)); G::streamFile($support, true); G::rm_dir($support); diff --git a/workflow/engine/controllers/caseSchedulerProxy.php b/workflow/engine/controllers/caseSchedulerProxy.php index 0707cecfe..cc119cb4f 100644 --- a/workflow/engine/controllers/caseSchedulerProxy.php +++ b/workflow/engine/controllers/caseSchedulerProxy.php @@ -97,7 +97,7 @@ class caseSchedulerProxy extends HttpProxyController } else { $http = 'http://'; } - $endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; + $endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; @$client = new SoapClient( $endpoint ); $user = $sWS_USER; diff --git a/workflow/engine/controllers/designer.php b/workflow/engine/controllers/designer.php index efa0d8ccb..55590ff0a 100644 --- a/workflow/engine/controllers/designer.php +++ b/workflow/engine/controllers/designer.php @@ -62,7 +62,7 @@ class Designer extends Controller $this->setVar('credentials', base64_encode(json_encode($clientToken))); $this->setVar('isDebugMode', $debug); $this->setVar("distribution", $distribution); - $this->setVar("SYS_SYS", SYS_SYS); + $this->setVar("SYS_SYS", config("sys_sys")); $this->setVar("SYS_LANG", SYS_LANG); $this->setVar("SYS_SKIN", SYS_SKIN); $this->setVar('HTTP_SERVER_HOSTNAME', System::getHttpServerHostnameRequestsFrontEnd()); @@ -219,7 +219,7 @@ class Designer extends Controller } Tracker::authentication($_SESSION['CASE'], $_SESSION['PIN']); } catch (\Exception $e) { - Bootstrap::registerMonolog('CaseTracker', 400, $e->getMessage(), [], SYS_SYS, 'processmaker.log'); + Bootstrap::registerMonolog('CaseTracker', 400, $e->getMessage(), [], config("sys_sys"), 'processmaker.log'); \G::header('Location: /errors/error403.php'); die(); } diff --git a/workflow/engine/controllers/home.php b/workflow/engine/controllers/home.php index c3e9d8ea7..ff07bad55 100644 --- a/workflow/engine/controllers/home.php +++ b/workflow/engine/controllers/home.php @@ -131,7 +131,7 @@ class Home extends Controller if (!isset($_COOKIE['workspaceSkin'])) { if (substr( $sysConf['default_skin'], 0, 2 ) == 'ux') { $_SESSION['_defaultUserLocation'] = $switchLink; - $switchLink = '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . $sysConf['default_skin'] . '/main'; + $switchLink = '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . $sysConf['default_skin'] . '/main'; } } diff --git a/workflow/engine/controllers/installer.php b/workflow/engine/controllers/installer.php index aca7f0526..285d5659f 100644 --- a/workflow/engine/controllers/installer.php +++ b/workflow/engine/controllers/installer.php @@ -919,6 +919,7 @@ class InstallerModule extends Controller define( 'SYSTEM_HASH', $sh ); define( 'PATH_DB', $pathShared . 'sites' . PATH_SEP ); define( 'SYS_SYS', $workspace ); + config(["sys_sys" => $workspace]); require_once ("propel/Propel.php"); diff --git a/workflow/engine/controllers/main.php b/workflow/engine/controllers/main.php index a7a35c9e8..b33420bc5 100644 --- a/workflow/engine/controllers/main.php +++ b/workflow/engine/controllers/main.php @@ -17,7 +17,7 @@ class Main extends Controller public function __construct () { - $this->memcache = & PMmemcached::getSingleton( defined( 'SYS_SYS' ) ? SYS_SYS : '' ); + $this->memcache = & PMmemcached::getSingleton( defined( 'SYS_SYS' ) ? config("sys_sys") : '' ); define( 'ERROR_EXCEPTION', 1 ); define( 'INFO_EXCEPTION', 3 ); @@ -40,7 +40,7 @@ class Main extends Controller $this->setVar( 'pipe', isset( $_SESSION['USR_USERNAME'] ) ? ' | ' : '' ); $this->setVar( 'rolename', $this->getUserRole() ); $this->setVar( 'logout', G::LoadTranslation( 'ID_LOGOUT' ) ); - $this->setVar( 'workspace', defined( 'SYS_SYS' ) ? ucfirst( SYS_SYS ) : '' ); + $this->setVar( 'workspace', defined( 'SYS_SYS' ) ? ucfirst( config("sys_sys") ) : '' ); $this->setVar( 'user_avatar', 'users/users_ViewPhotoGrid?pUID=' . $_SESSION['USER_LOGGED'] . '&h=' . rand() ); // license notification @@ -480,9 +480,9 @@ class Main extends Controller $logoPlugin = $oPluginRegistry->getCompanyLogo( $sCompanyLogo ); if ($logoPlugin != '/images/processmaker2.logo2.png') { $sCompanyLogo = $logoPlugin; - } elseif (isset( $sFotoSelect ) && $sFotoSelect != '' && ! (strcmp( $sWspaceSelect, SYS_SYS ))) { + } elseif (isset( $sFotoSelect ) && $sFotoSelect != '' && ! (strcmp( $sWspaceSelect, config("sys_sys") ))) { $sCompanyLogo = $oPluginRegistry->getCompanyLogo( $sFotoSelect ); - $sCompanyLogo = "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/adminProxy/showLogoFile?id=" . base64_encode( $sCompanyLogo ); + $sCompanyLogo = "/sys" . config("sys_sys") . "/" . SYS_LANG . "/" . SYS_SKIN . "/adminProxy/showLogoFile?id=" . base64_encode( $sCompanyLogo ); } } return $sCompanyLogo; @@ -778,7 +778,7 @@ class Main extends Controller ); } - $properties[] = array ( G::LoadTranslation('ID_WORKSPACE') ,defined( "SYS_SYS" ) ? SYS_SYS : "Not defined",$pmSection + $properties[] = array ( G::LoadTranslation('ID_WORKSPACE') ,defined( "SYS_SYS" ) ? config("sys_sys") : "Not defined",$pmSection ); $properties[] = array ( G::LoadTranslation('ID_SERVER_PROTOCOL') ,getenv( 'SERVER_PROTOCOL' ),$sysSection diff --git a/workflow/engine/controllers/pmTables.php b/workflow/engine/controllers/pmTables.php index 65a58531c..1ad74be00 100644 --- a/workflow/engine/controllers/pmTables.php +++ b/workflow/engine/controllers/pmTables.php @@ -147,7 +147,7 @@ class pmTables extends Controller public function streamExported ($httpData) { - $PUBLIC_ROOT_PATH = PATH_DATA . 'sites' . PATH_SEP . SYS_SYS . PATH_SEP . 'public' . PATH_SEP; + $PUBLIC_ROOT_PATH = PATH_DATA . 'sites' . PATH_SEP . config("sys_sys") . PATH_SEP . 'public' . PATH_SEP; $sFileName = $httpData->f; $realPath = $PUBLIC_ROOT_PATH . $sFileName; diff --git a/workflow/engine/controllers/pmTablesProxy.php b/workflow/engine/controllers/pmTablesProxy.php index 41243e7f2..8aef2ea59 100644 --- a/workflow/engine/controllers/pmTablesProxy.php +++ b/workflow/engine/controllers/pmTablesProxy.php @@ -117,7 +117,7 @@ class pmTablesProxy extends HttpProxyController $dbConn = new DbConnections(); $dbConnections = $dbConn->getConnectionsProUid( $proUid, array('mysql') ); - $workSpace = new WorkspaceTools(SYS_SYS); + $workSpace = new WorkspaceTools(config("sys_sys")); $workspaceDB = $workSpace->getDBInfo(); if ($workspaceDB['DB_NAME'] == $workspaceDB['DB_RBAC_NAME']) { @@ -399,7 +399,7 @@ class pmTablesProxy extends HttpProxyController $primaryKeys = $oAdditionalTables->getPrimaryKeys( 'keys' ); $this->className = $table['ADD_TAB_CLASS_NAME']; $this->classPeerName = $this->className . 'Peer'; - $sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP; + $sPath = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; if (! file_exists( $sPath . $this->className . '.php' )) { throw new Exception( 'Update:: ' . G::loadTranslation( 'ID_PMTABLE_CLASS_DOESNT_EXIST', $this->className ) ); @@ -440,7 +440,7 @@ class pmTablesProxy extends HttpProxyController $table = $oAdditionalTables->load( $httpData->id, true ); $this->className = $table['ADD_TAB_CLASS_NAME']; $this->classPeerName = $this->className . 'Peer'; - $sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP; + $sPath = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; if (! file_exists( $sPath . $this->className . '.php' )) { throw new Exception( 'Destroy:: ' . G::loadTranslation( 'ID_PMTABLE_CLASS_DOESNT_EXIST', $this->className ) ); @@ -664,7 +664,7 @@ class pmTablesProxy extends HttpProxyController $rows = $resultData['rows']; $count = $resultData['count']; - $PUBLIC_ROOT_PATH = PATH_DATA . 'sites' . PATH_SEP . SYS_SYS . PATH_SEP . 'public' . PATH_SEP; + $PUBLIC_ROOT_PATH = PATH_DATA . 'sites' . PATH_SEP . config("sys_sys") . PATH_SEP . 'public' . PATH_SEP; $filenameOnly = strtolower($aAdditionalTables['ADD_TAB_NAME'] . "_" . date("Y-m-d") . '_' . date("Hi") . ".csv"); $filename = $PUBLIC_ROOT_PATH . $filenameOnly; $fp = fopen($filename, "wb"); @@ -733,7 +733,7 @@ class pmTablesProxy extends HttpProxyController $_SESSION['FILES_FORM'] = $_FILES['form']; - $PUBLIC_ROOT_PATH = PATH_DATA . 'sites' . PATH_SEP . SYS_SYS . PATH_SEP . 'public' . PATH_SEP; + $PUBLIC_ROOT_PATH = PATH_DATA . 'sites' . PATH_SEP . config("sys_sys") . PATH_SEP . 'public' . PATH_SEP; $filename = $_FILES['form']['name']['FILENAME']; $tempName = $_FILES['form']['tmp_name']['FILENAME']; @@ -923,7 +923,7 @@ class pmTablesProxy extends HttpProxyController $result = new stdClass(); $net = new Net( G::getIpAddress() ); - $META = " \n-----== ProcessMaker Open Source Private Tables ==-----\n" . " @Ver: 1.0 Oct-2009\n" . " @Processmaker version: " . System::getVersion() . "\n" . " -------------------------------------------------------\n" . " @Export Date: " . date( "l jS \of F Y h:i:s A" ) . "\n" . " @Server address: " . getenv( 'SERVER_NAME' ) . " (" . getenv( 'SERVER_ADDR' ) . ")\n" . " @Client address: " . $net->hostname . "\n" . " @Workspace: " . SYS_SYS . "\n" . " @Export trace back:\n\n"; + $META = " \n-----== ProcessMaker Open Source Private Tables ==-----\n" . " @Ver: 1.0 Oct-2009\n" . " @Processmaker version: " . System::getVersion() . "\n" . " -------------------------------------------------------\n" . " @Export Date: " . date( "l jS \of F Y h:i:s A" ) . "\n" . " @Server address: " . getenv( 'SERVER_NAME' ) . " (" . getenv( 'SERVER_ADDR' ) . ")\n" . " @Client address: " . $net->hostname . "\n" . " @Workspace: " . config("sys_sys") . "\n" . " @Export trace back:\n\n"; $EXPORT_TRACEBACK = Array (); $c = 0; @@ -947,9 +947,9 @@ class pmTablesProxy extends HttpProxyController $META .= $sTrace; ///////////////EXPORT PROCESS - $PUBLIC_ROOT_PATH = PATH_DATA . 'sites' . PATH_SEP . SYS_SYS . PATH_SEP . 'public' . PATH_SEP; + $PUBLIC_ROOT_PATH = PATH_DATA . 'sites' . PATH_SEP . config("sys_sys") . PATH_SEP . 'public' . PATH_SEP; - $filenameOnly = strtolower( 'SYS-' . SYS_SYS . "_" . date( "Y-m-d" ) . '_' . date( "Hi" ) . ".pmt" ); + $filenameOnly = strtolower( 'SYS-' . config("sys_sys") . "_" . date( "Y-m-d" ) . '_' . date( "Hi" ) . ".pmt" ); $filename = $PUBLIC_ROOT_PATH . $filenameOnly; $fp = fopen( $filename, "wb" ); diff --git a/workflow/engine/controllers/strategicDashboard.php b/workflow/engine/controllers/strategicDashboard.php index 0a39b6a24..d4d51ecb7 100644 --- a/workflow/engine/controllers/strategicDashboard.php +++ b/workflow/engine/controllers/strategicDashboard.php @@ -33,7 +33,7 @@ class StrategicDashboard extends Controller $user = new Users(); $user = $user->load($RBAC->aUserInfo['USER_INFO']['USR_UID']); $this->usrUnitCost = $this->currencySymbolToShow($user); - $this->urlProxy = System::getHttpServerHostnameRequestsFrontEnd() . '/api/1.0/' . SYS_SYS . '/'; + $this->urlProxy = System::getHttpServerHostnameRequestsFrontEnd() . '/api/1.0/' . config("sys_sys") . '/'; //change $clientId = 'x-pm-local-client'; $client = $this->getClientCredentials($clientId); @@ -194,7 +194,7 @@ class StrategicDashboard extends Controller $this->setView( 'strategicDashboard/viewDashboard' ); $this->setVar('urlProxy', $this->urlProxy); - $this->setVar('SYS_SYS', SYS_SYS); + $this->setVar('SYS_SYS', config("sys_sys")); $this->setVar('usrId', $this->usrId); $this->setVar('credentials', $this->clientToken); $this->setVar('unitCost', $this->usrUnitCost); diff --git a/workflow/engine/controllers/webEntryProxy.php b/workflow/engine/controllers/webEntryProxy.php index 1b350e04e..bcb096212 100644 --- a/workflow/engine/controllers/webEntryProxy.php +++ b/workflow/engine/controllers/webEntryProxy.php @@ -21,8 +21,8 @@ class webEntryProxy extends HttpProxyController $editEvent['EVN_CONDITIONS'] = null; $event->update( $editEvent ); - unlink( PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $pro_uid . PATH_SEP . $filename ); - unlink( PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $pro_uid . PATH_SEP . str_replace( ".php", "Post", $filename ) . ".php" ); + unlink( PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP . "public" . PATH_SEP . $pro_uid . PATH_SEP . $filename ); + unlink( PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP . "public" . PATH_SEP . $pro_uid . PATH_SEP . str_replace( ".php", "Post", $filename ) . ".php" ); $this->success = true; $this->msg = G::LoadTranslation( 'ID_WEB_ENTRY_SUCCESS_DELETE' ); @@ -46,7 +46,7 @@ class webEntryProxy extends HttpProxyController $http = 'http://'; } - $endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; + $endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; @$client = new SoapClient( $endpoint ); $user = $sWS_USER; @@ -122,8 +122,8 @@ class webEntryProxy extends HttpProxyController $pro_uid = $params->pro_uid; $filename = $xDYNA; $filename = $filename . '.php'; - unlink( PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $pro_uid . PATH_SEP . $filename ); - unlink( PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $pro_uid . PATH_SEP . str_replace( ".php", "Post", $filename ) . ".php" ); + unlink( PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP . "public" . PATH_SEP . $pro_uid . PATH_SEP . $filename ); + unlink( PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP . "public" . PATH_SEP . $pro_uid . PATH_SEP . str_replace( ".php", "Post", $filename ) . ".php" ); } $pathProcess = PATH_DATA_SITE . 'public' . PATH_SEP . $sPRO_UID . PATH_SEP; @@ -167,8 +167,8 @@ class webEntryProxy extends HttpProxyController $pluginTpl = PATH_CORE . 'templates' . PATH_SEP . 'processes' . PATH_SEP . 'webentryPost.tpl'; $template = new TemplatePower( $pluginTpl ); $template->prepare(); - $template->assign( 'wsdlUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2' ); - $template->assign( 'wsUploadUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/upload' ); + $template->assign( 'wsdlUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2' ); + $template->assign( 'wsUploadUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/upload' ); $template->assign( 'processUid', $sPRO_UID ); $template->assign( 'dynaformUid', $sDYNAFORM ); $template->assign( 'taskUid', $sTASKS ); @@ -184,7 +184,7 @@ class webEntryProxy extends HttpProxyController $template->assign( 'dynaform', $dynTitle ); $template->assign( 'timestamp', date( 'l jS \of F Y h:i:s A' ) ); - $template->assign( 'ws', SYS_SYS ); + $template->assign( 'ws', config("sys_sys") ); $template->assign( 'version', System::getVersion() ); $fileName = $pathProcess . $dynTitle . 'Post.php'; @@ -218,7 +218,7 @@ class webEntryProxy extends HttpProxyController $aDataEvent['EVN_CONDITIONS'] = $sWS_USER; $output = $oEvent->update( $aDataEvent ); - $link = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $sPRO_UID . '/' . $dynTitle . '.php'; + $link = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $sPRO_UID . '/' . $dynTitle . '.php'; $this->success = true; $this->msg = G::LoadTranslation( 'ID_WEB_ENTRY_SUCCESS_NEW' ); diff --git a/workflow/engine/methods/cases/caseConsolidated.php b/workflow/engine/methods/cases/caseConsolidated.php index 07e5aea99..2df5c5241 100644 --- a/workflow/engine/methods/cases/caseConsolidated.php +++ b/workflow/engine/methods/cases/caseConsolidated.php @@ -263,7 +263,7 @@ if ($sStatus == '1') { $oAdditionalTables->createPropelClasses($tableName, $sClassName, $aFieldsClases, $sTasUid); } else { - $sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP; + $sPath = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; @unlink($sPath . $sClassName . '.php'); @unlink($sPath . $sClassName . 'Peer.php'); @unlink($sPath . PATH_SEP . 'map' . PATH_SEP . $sClassName . 'MapBuilder.php'); diff --git a/workflow/engine/methods/cases/casesConsolidatedListExtJs.php b/workflow/engine/methods/cases/casesConsolidatedListExtJs.php index 58d21dfa9..e4041384c 100644 --- a/workflow/engine/methods/cases/casesConsolidatedListExtJs.php +++ b/workflow/engine/methods/cases/casesConsolidatedListExtJs.php @@ -71,7 +71,7 @@ while ($rsSql->next()) { } if (count($arrayTabItem) > 0) { - $urlProxy = System::getHttpServerHostnameRequestsFrontEnd() . '/api/1.0/' . SYS_SYS . '/consolidated/'; + $urlProxy = System::getHttpServerHostnameRequestsFrontEnd() . '/api/1.0/' . config("sys_sys") . '/consolidated/'; $clientId = 'x-pm-local-client'; $client = getClientCredentials($clientId); $authCode = getAuthorizationCode($client); diff --git a/workflow/engine/methods/cases/casesListExtJs.php b/workflow/engine/methods/cases/casesListExtJs.php index 962779261..5b488bd1f 100644 --- a/workflow/engine/methods/cases/casesListExtJs.php +++ b/workflow/engine/methods/cases/casesListExtJs.php @@ -176,9 +176,9 @@ if ($licensedFeatures->verifyfeature('r19Vm5DK1UrT09MenlLYjZxejlhNUZ1b1NhV0JHWjB if (isset($_COOKIE['dashboardListInbox'])) { $oHeadPublisher->assign('valueFilterStatus', $_COOKIE['dashboardListInbox']); if (PHP_VERSION < 5.2) { - setcookie("dashboardListInbox", '', time() + (24 * 60 * 60), "/sys" . SYS_SYS, "; HttpOnly"); + setcookie("dashboardListInbox", '', time() + (24 * 60 * 60), "/sys" . config("sys_sys"), "; HttpOnly"); } else { - setcookie("dashboardListInbox", '', time() + (24 * 60 * 60), "/sys" . SYS_SYS, null, false, true); + setcookie("dashboardListInbox", '', time() + (24 * 60 * 60), "/sys" . config("sys_sys"), null, false, true); } } } diff --git a/workflow/engine/methods/cases/cases_SaveDataSupervisor.php b/workflow/engine/methods/cases/cases_SaveDataSupervisor.php index 70a6487df..1717d9d4b 100644 --- a/workflow/engine/methods/cases/cases_SaveDataSupervisor.php +++ b/workflow/engine/methods/cases/cases_SaveDataSupervisor.php @@ -142,8 +142,8 @@ if (isset( $_FILES["form"]["name"] ) && count( $_FILES["form"]["name"] ) > 0) { if($res->status == 0){ $message = $res->message; G::SendMessageText( $message, "ERROR" ); - $backUrlObj = explode( "sys" . SYS_SYS, $_SERVER['HTTP_REFERER'] ); - G::header( "location: " . "/sys" . SYS_SYS . $backUrlObj[1] ); + $backUrlObj = explode( "sys" . config("sys_sys"), $_SERVER['HTTP_REFERER'] ); + G::header( "location: " . "/sys" . config("sys_sys") . $backUrlObj[1] ); die(); } @@ -156,8 +156,8 @@ if (isset( $_FILES["form"]["name"] ) && count( $_FILES["form"]["name"] ) > 0) { if ($inpDocMaxFilesize > 0 && $fileSizeByField > 0) { if ($fileSizeByField > $inpDocMaxFilesize) { G::SendMessageText(G::LoadTranslation("ID_SIZE_VERY_LARGE_PERMITTED"), "ERROR"); - $arrayAux1 = explode("sys" . SYS_SYS, $_SERVER["HTTP_REFERER"]); - G::header("location: /sys" . SYS_SYS . $arrayAux1[1]); + $arrayAux1 = explode("sys" . config("sys_sys"), $_SERVER["HTTP_REFERER"]); + G::header("location: /sys" . config("sys_sys") . $arrayAux1[1]); exit(0); } } diff --git a/workflow/engine/methods/cases/cases_SaveDocument.php b/workflow/engine/methods/cases/cases_SaveDocument.php index ae948fc46..5ca38442d 100644 --- a/workflow/engine/methods/cases/cases_SaveDocument.php +++ b/workflow/engine/methods/cases/cases_SaveDocument.php @@ -54,8 +54,8 @@ if ((isset( $_FILES['form'] )) && ($_FILES['form']['error']['APP_DOC_FILENAME'] break; } G::SendMessageText( $message, "ERROR" ); - $backUrlObj = explode( "sys" . SYS_SYS, $_SERVER['HTTP_REFERER'] ); - G::header( "location: " . "/sys" . SYS_SYS . $backUrlObj[1] ); + $backUrlObj = explode( "sys" . config("sys_sys"), $_SERVER['HTTP_REFERER'] ); + G::header( "location: " . "/sys" . config("sys_sys") . $backUrlObj[1] ); die(); } @@ -106,8 +106,8 @@ if(isset($_FILES["form"]["name"]["APP_DOC_FILENAME"]) && isset($_FILES["form"][" if($res->status == 0){ $message = $res->message; G::SendMessageText( $message, "ERROR" ); - $backUrlObj = explode( "sys" . SYS_SYS, $_SERVER['HTTP_REFERER'] ); - G::header( "location: " . "/sys" . SYS_SYS . $backUrlObj[1] ); + $backUrlObj = explode( "sys" . config("sys_sys"), $_SERVER['HTTP_REFERER'] ); + G::header( "location: " . "/sys" . config("sys_sys") . $backUrlObj[1] ); die(); } @@ -134,8 +134,8 @@ if (isset($_FILES) && isset($_FILES["form"]) && count($_FILES["form"]) > 0) { } catch (Exception $e) { G::SendMessageText($e->getMessage(), "ERROR"); - $arrayAux = explode("sys" . SYS_SYS, $_SERVER["HTTP_REFERER"]); - G::header("location: /sys" . SYS_SYS . $arrayAux[1]); + $arrayAux = explode("sys" . config("sys_sys"), $_SERVER["HTTP_REFERER"]); + G::header("location: /sys" . config("sys_sys") . $arrayAux[1]); exit(0); } } diff --git a/workflow/engine/methods/cases/cases_SchedulerValidateUser.php b/workflow/engine/methods/cases/cases_SchedulerValidateUser.php index 752c4ff38..7a0f81380 100644 --- a/workflow/engine/methods/cases/cases_SchedulerValidateUser.php +++ b/workflow/engine/methods/cases/cases_SchedulerValidateUser.php @@ -40,7 +40,7 @@ if (G::is_https()) { $http = 'http://'; } -$endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; +$endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; $client = new SoapClient($endpoint, $streamContext); $user = $sWS_USER; diff --git a/workflow/engine/methods/cases/cases_ShowDocument.php b/workflow/engine/methods/cases/cases_ShowDocument.php index 702135e6b..d5cca7777 100644 --- a/workflow/engine/methods/cases/cases_ShowDocument.php +++ b/workflow/engine/methods/cases/cases_ShowDocument.php @@ -109,8 +109,8 @@ if (! $sw_file_exists) { print G::json_encode( $res ); } else { G::SendMessageText( $error_message, "ERROR" ); - $backUrlObj = explode( "sys" . SYS_SYS, $_SERVER['HTTP_REFERER'] ); - G::header( "location: " . "/sys" . SYS_SYS . $backUrlObj[1] ); + $backUrlObj = explode( "sys" . config("sys_sys"), $_SERVER['HTTP_REFERER'] ); + G::header( "location: " . "/sys" . config("sys_sys") . $backUrlObj[1] ); die(); } diff --git a/workflow/engine/methods/cases/cases_ShowOutputDocument.php b/workflow/engine/methods/cases/cases_ShowOutputDocument.php index 27f8d0e2f..7df20fc28 100644 --- a/workflow/engine/methods/cases/cases_ShowOutputDocument.php +++ b/workflow/engine/methods/cases/cases_ShowOutputDocument.php @@ -122,8 +122,8 @@ if (!$sw_file_exists) { print G::json_encode( $res ); } else { G::SendMessageText( $error_message, "ERROR" ); - $backUrlObj = explode( "sys" . SYS_SYS, $_SERVER['HTTP_REFERER'] ); - G::header( "location: " . "/sys" . SYS_SYS . $backUrlObj[1] ); + $backUrlObj = explode( "sys" . config("sys_sys"), $_SERVER['HTTP_REFERER'] ); + G::header( "location: " . "/sys" . config("sys_sys") . $backUrlObj[1] ); die(); } diff --git a/workflow/engine/methods/cases/main_init.php b/workflow/engine/methods/cases/main_init.php index f401a5239..23a54933a 100644 --- a/workflow/engine/methods/cases/main_init.php +++ b/workflow/engine/methods/cases/main_init.php @@ -29,7 +29,7 @@ $oHeadPublisher->addExtJsScript( "cases/main", false ); //Adding a javascript fi $oHeadPublisher->addContent( "cases/main" ); //Adding a html file .html. $keyMem = "USER_PREFERENCES" . $_SESSION["USER_LOGGED"]; -$memcache = &PMmemcached::getSingleton( SYS_SYS ); +$memcache = &PMmemcached::getSingleton( config("sys_sys") ); if (($arrayConfig = $memcache->get( $keyMem )) === false) { $conf->loadConfig( $x, "USER_PREFERENCES", "", "", $_SESSION["USER_LOGGED"], "" ); diff --git a/workflow/engine/methods/enterprise/addonsStore.php b/workflow/engine/methods/enterprise/addonsStore.php index b078b4d23..a9d494aed 100644 --- a/workflow/engine/methods/enterprise/addonsStore.php +++ b/workflow/engine/methods/enterprise/addonsStore.php @@ -63,7 +63,7 @@ $oHeadPublisher->assign("supportStartDate", (isset($licenseManager->supportStart $oHeadPublisher->assign("supportEndDate", (isset($licenseManager->supportEndDate))? $licenseManager->supportEndDate : ''); $oHeadPublisher->assign("PROCESSMAKER_VERSION", System::getVersion()); -$oHeadPublisher->assign("PROCESSMAKER_URL", "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN ); +$oHeadPublisher->assign("PROCESSMAKER_URL", "/sys" . config("sys_sys") . "/" . SYS_LANG . "/" . SYS_SKIN ); $oHeadPublisher->assign("SYS_SKIN", SYS_SKIN); $oHeadPublisher->assign("URL_PART_LOGIN", ((substr(SYS_SKIN, 0, 2) == "ux" && SYS_SKIN != "uxs")? "main/login" : "login/login")); $oHeadPublisher->assign("URL_PART_SETUP", EnterpriseUtils::getUrlPartSetup()); diff --git a/workflow/engine/methods/enterprise/addonsStoreAction.php b/workflow/engine/methods/enterprise/addonsStoreAction.php index 36a95c0e7..970464401 100644 --- a/workflow/engine/methods/enterprise/addonsStoreAction.php +++ b/workflow/engine/methods/enterprise/addonsStoreAction.php @@ -160,7 +160,7 @@ try { } /////// - $workspace = SYS_SYS; + $workspace = config("sys_sys"); $dbAdapter = DB_ADAPTER; $addon->setAddonState("download-start"); diff --git a/workflow/engine/methods/enterprise/enterprise.php b/workflow/engine/methods/enterprise/enterprise.php index 824b58bdc..f70b3f842 100644 --- a/workflow/engine/methods/enterprise/enterprise.php +++ b/workflow/engine/methods/enterprise/enterprise.php @@ -8,7 +8,7 @@ if (!defined("PATH_PM_ENTERPRISE")) { } if (!defined("PATH_DATA_SITE")) { - define("PATH_DATA_SITE", PATH_DATA . "sites/" . SYS_SYS . "/"); + define("PATH_DATA_SITE", PATH_DATA . "sites/" . config("sys_sys") . "/"); } set_include_path(PATH_PM_ENTERPRISE . PATH_SEPARATOR . get_include_path()); @@ -78,12 +78,12 @@ class enterprisePlugin extends PMPlugin unset($_SESSION["__EE_SW_PMLICENSEMANAGER__"]); /////// - $js = "window.open(\"/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/setup/main?s=PLUGINS\", \"_top\", \"\");"; + $js = "window.open(\"/sys" . config("sys_sys") . "/" . SYS_LANG . "/" . SYS_SKIN . "/setup/main?s=PLUGINS\", \"_top\", \"\");"; if (substr(SYS_SKIN, 0, 2) == "ux" && SYS_SKIN != "uxs") { - //$js = "parent.window.location.href = \"/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/setup/main_init?s=PLUGINS\";"; - //$js = "window.location.href = \"/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/setup/pluginsImport\";"; - $js = "window.open(\"/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/main\", \"_top\", \"\");"; + //$js = "parent.window.location.href = \"/sys" . config("sys_sys") . "/" . SYS_LANG . "/" . SYS_SKIN . "/setup/main_init?s=PLUGINS\";"; + //$js = "window.location.href = \"/sys" . config("sys_sys") . "/" . SYS_LANG . "/" . SYS_SKIN . "/setup/pluginsImport\";"; + $js = "window.open(\"/sys" . config("sys_sys") . "/" . SYS_LANG . "/" . SYS_SKIN . "/main\", \"_top\", \"\");"; } /////// diff --git a/workflow/engine/methods/enterprise/processMakerAjax.php b/workflow/engine/methods/enterprise/processMakerAjax.php index e034d2ae6..594a0c03c 100644 --- a/workflow/engine/methods/enterprise/processMakerAjax.php +++ b/workflow/engine/methods/enterprise/processMakerAjax.php @@ -63,7 +63,7 @@ function install($file) $context = stream_context_create($option); /////// - $fileData = @fopen(EnterpriseUtils::getUrlServerName() . "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/enterprise/services/processMakerUpgrade", "rb", false, $context); + $fileData = @fopen(EnterpriseUtils::getUrlServerName() . "/sys" . config("sys_sys") . "/" . SYS_LANG . "/" . SYS_SKIN . "/enterprise/services/processMakerUpgrade", "rb", false, $context); if ($fileData === false) { throw (new Exception("Could not open services url.")); diff --git a/workflow/engine/methods/login/authentication.php b/workflow/engine/methods/login/authentication.php index 6934fe4ca..c2f6fc266 100644 --- a/workflow/engine/methods/login/authentication.php +++ b/workflow/engine/methods/login/authentication.php @@ -146,7 +146,7 @@ try { $errLabel = G::LoadTranslation('ID_ACCOUNT') . ' "' . $usr . '" ' . G::LoadTranslation('ID_ACCOUNT_DISABLED_CONTACT_ADMIN'); } //Log failed authentications - $message = "| Many failed authentication attempts for USER: " . $usr . " | IP: " . G::getIpAddress() . " | WS: " . SYS_SYS; + $message = "| Many failed authentication attempts for USER: " . $usr . " | IP: " . G::getIpAddress() . " | WS: " . config("sys_sys"); $message .= " | BROWSER: " . $_SERVER['HTTP_USER_AGENT']; G::log($message, PATH_DATA, 'loginFailed.log'); @@ -171,7 +171,7 @@ try { } if (!isset( $_SESSION['WORKSPACE'] ) ) { - $_SESSION['WORKSPACE'] = SYS_SYS; + $_SESSION['WORKSPACE'] = config("sys_sys"); } //Execute the SSO Script from plugin @@ -248,7 +248,7 @@ try { $userTimeZone = $user->getUsrTimeZone(); if (trim($userTimeZone) == '') { - $arraySystemConfiguration = System::getSystemConfiguration('', '', SYS_SYS); + $arraySystemConfiguration = System::getSystemConfiguration('', '', config("sys_sys")); $userTimeZone = $arraySystemConfiguration['time_zone']; } @@ -409,7 +409,7 @@ try { die; } - $configS = System::getSystemConfiguration('', '', SYS_SYS); + $configS = System::getSystemConfiguration('', '', config("sys_sys")); $activeSession = isset($configS['session_block']) ? !(int)$configS['session_block']:true; if ($activeSession){ setcookie("PM-TabPrimary", 101010010, time() + (24 * 60 * 60), '/'); diff --git a/workflow/engine/methods/login/authenticationSso.php b/workflow/engine/methods/login/authenticationSso.php index 1d8a9cafb..30e902e9e 100644 --- a/workflow/engine/methods/login/authenticationSso.php +++ b/workflow/engine/methods/login/authenticationSso.php @@ -20,7 +20,7 @@ try { } header( - 'Location: /sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . + 'Location: /sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/login/login' . (($u != '')? '?u=' . $u : '') ); @@ -40,7 +40,7 @@ try { } /*----------------------------------********---------------------------------*/ - $arraySystemConfiguration = System::getSystemConfiguration('', '', SYS_SYS); + $arraySystemConfiguration = System::getSystemConfiguration('', '', config("sys_sys")); //Set User Time Zone $user = UsersPeer::retrieveByPK($userUid); diff --git a/workflow/engine/methods/login/login.php b/workflow/engine/methods/login/login.php index 8faa2997c..5c040d1e2 100644 --- a/workflow/engine/methods/login/login.php +++ b/workflow/engine/methods/login/login.php @@ -188,9 +188,9 @@ session_start(); session_regenerate_id(); if (PHP_VERSION < 5.2) { - setcookie("workspaceSkin", SYS_SKIN, time() + (24 * 60 * 60), "/sys" . SYS_SYS, "; HttpOnly"); + setcookie("workspaceSkin", SYS_SKIN, time() + (24 * 60 * 60), "/sys" . config("sys_sys"), "; HttpOnly"); } else { - setcookie("workspaceSkin", SYS_SKIN, time() + (24 * 60 * 60), "/sys" . SYS_SYS, null, false, true); + setcookie("workspaceSkin", SYS_SKIN, time() + (24 * 60 * 60), "/sys" . config("sys_sys"), null, false, true); } if (strlen($msg) > 0) { @@ -361,7 +361,7 @@ $flagForgotPassword = isset($oConf->aConfig['login_enableForgotPassword']) setcookie('PM-Warning', trim(G::LoadTranslation('ID_BLOCKER_MSG'), '*'), time() + (24 * 60 * 60), SYS_URI); -$configS = System::getSystemConfiguration('', '', SYS_SYS); +$configS = System::getSystemConfiguration('', '', config("sys_sys")); $activeSession = isset($configS['session_block']) ? !(int)$configS['session_block'] : true; if ($activeSession) { setcookie("PM-TabPrimary", 101010010, time() + (24 * 60 * 60), '/'); diff --git a/workflow/engine/methods/oauth2/grant.php b/workflow/engine/methods/oauth2/grant.php index 6d2ab8547..f3760503e 100644 --- a/workflow/engine/methods/oauth2/grant.php +++ b/workflow/engine/methods/oauth2/grant.php @@ -9,7 +9,7 @@ if (! empty($_GET['error'])) { $http = G::is_https() ? 'https' : 'http'; $host = $_SERVER['SERVER_NAME'] . ($_SERVER['SERVER_PORT'] != '80' ? ':' . $_SERVER['SERVER_PORT'] : ''); -$endpoint = sprintf('%s://%s/%s/oauth2/token', $http, $host, SYS_SYS); +$endpoint = sprintf('%s://%s/%s/oauth2/token', $http, $host, config("sys_sys")); $code = empty($_GET['code']) ? 'NN' : $_GET['code']; $clientId = 'x-pm-local-client'; diff --git a/workflow/engine/methods/processes/consolidated.php b/workflow/engine/methods/processes/consolidated.php index 82d1692bb..8439d9ad5 100644 --- a/workflow/engine/methods/processes/consolidated.php +++ b/workflow/engine/methods/processes/consolidated.php @@ -19,7 +19,7 @@ class AdditionalTablesConsolidated extends AdditionalTables $sClassName = $this->getPHPName($sTableName); } - $sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP; + $sPath = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; if (!file_exists($sPath)) { G::mk_dir($sPath); G::mk_dir($sPath . 'map'); @@ -626,7 +626,7 @@ class ajax_con extends WebResource $oAdditionalTables->createPropelClasses($tableName, $sClassName, $aFieldsClases, $sTasUid); } else { - $sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP; + $sPath = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; @unlink($sPath . $sClassName . '.php'); @unlink($sPath . $sClassName . 'Peer.php'); @unlink($sPath . PATH_SEP . 'map' . PATH_SEP . $sClassName . 'MapBuilder.php'); diff --git a/workflow/engine/methods/processes/mainInit.php b/workflow/engine/methods/processes/mainInit.php index ef7697246..6ad7d9768 100644 --- a/workflow/engine/methods/processes/mainInit.php +++ b/workflow/engine/methods/processes/mainInit.php @@ -92,7 +92,7 @@ $oHeadPublisher->assign("arrayContextMenuOptionPlugin", $arrayContextMenuOptionP $oHeadPublisher->assign('extJsViewState', $oHeadPublisher->getExtJsViewState()); $designer = new Designer(); -$oHeadPublisher->assign('SYS_SYS', SYS_SYS); +$oHeadPublisher->assign('SYS_SYS', config("sys_sys")); $oHeadPublisher->assign('SYS_LANG', SYS_LANG); $oHeadPublisher->assign('SYS_SKIN', SYS_SKIN); $oHeadPublisher->assign('HTTP_SERVER_HOSTNAME', System::getHttpServerHostnameRequestsFrontEnd()); diff --git a/workflow/engine/methods/processes/processesList.php b/workflow/engine/methods/processes/processesList.php index fc441d0e8..72e600b56 100644 --- a/workflow/engine/methods/processes/processesList.php +++ b/workflow/engine/methods/processes/processesList.php @@ -33,7 +33,7 @@ $oProcess = new Process(); $oProcess->dir = $dir; $oProcess->sort = $sort; -//$memcache = & PMmemcached::getSingleton( SYS_SYS ); +//$memcache = & PMmemcached::getSingleton( config("sys_sys") ); $memkey = 'no memcache'; $memcacheUsed = 'not used'; diff --git a/workflow/engine/methods/processes/processes_Ajax.php b/workflow/engine/methods/processes/processes_Ajax.php index d7bb2c1ef..def886f80 100644 --- a/workflow/engine/methods/processes/processes_Ajax.php +++ b/workflow/engine/methods/processes/processes_Ajax.php @@ -189,13 +189,13 @@ try { $filter = new InputFilter(); $form = $_REQUEST; - $filePath = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $form['PRO_UID'] . PATH_SEP . $form['FILENAME']; + $filePath = PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP . "public" . PATH_SEP . $form['PRO_UID'] . PATH_SEP . $form['FILENAME']; if (file_exists($filePath)) { unlink($filter->validateInput($filePath, 'path')); $webEntry = new \ProcessMaker\BusinessModel\WebEntry(); $webEntry->deleteClassic($form['PRO_UID'], $filePath); } - $filePath = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $form['PRO_UID'] . PATH_SEP . str_replace(".php", "Post", $form['FILENAME']) . ".php"; + $filePath = PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP . "public" . PATH_SEP . $form['PRO_UID'] . PATH_SEP . str_replace(".php", "Post", $form['FILENAME']) . ".php"; if (file_exists($filePath)) { unlink($filter->validateInput($filePath, 'path')); } @@ -900,8 +900,8 @@ try { $resultArray = array(); $proUid = isset($_REQUEST['PRO_UID']) ? $_REQUEST['PRO_UID'] : ''; $dynUid = isset($_REQUEST['DYN_UID']) ? $_REQUEST['DYN_UID'] : ''; - if (is_file(PATH_DATA . '/sites/' . SYS_SYS . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml') && filesize(PATH_DATA . '/sites/' . SYS_SYS . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml') > 0) { - $dyn = new DynaformHandler(PATH_DATA . '/sites/' . SYS_SYS . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml'); + if (is_file(PATH_DATA . '/sites/' . config("sys_sys") . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml') && filesize(PATH_DATA . '/sites/' . config("sys_sys") . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml') > 0) { + $dyn = new DynaformHandler(PATH_DATA . '/sites/' . config("sys_sys") . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml'); $dynaformFields[] = $dyn->getFields(); } foreach ($dynaformFields as $aDynFormFields) { diff --git a/workflow/engine/methods/processes/processes_DownloadFile.php b/workflow/engine/methods/processes/processes_DownloadFile.php index fee9c9c9b..07b7fa299 100644 --- a/workflow/engine/methods/processes/processes_DownloadFile.php +++ b/workflow/engine/methods/processes/processes_DownloadFile.php @@ -6,7 +6,7 @@ if (!isset($_GET["file_hash"])) { } $httpStream = new \ProcessMaker\Util\IO\HttpStream(); -$outputDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP; +$outputDir = PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP; $fileName = urldecode(base64_decode($_GET["file_hash"])); $processFile = $outputDir . $fileName; diff --git a/workflow/engine/methods/processes/processes_Export.php b/workflow/engine/methods/processes/processes_Export.php index 99c248bfc..bf8eb90a8 100644 --- a/workflow/engine/methods/processes/processes_Export.php +++ b/workflow/engine/methods/processes/processes_Export.php @@ -24,7 +24,7 @@ use ProcessMaker\Util\Common; $response = new StdClass(); -$outputDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP; +$outputDir = PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP; try { if(empty($_GET)){ diff --git a/workflow/engine/methods/processes/processes_Import_Ajax.php b/workflow/engine/methods/processes/processes_Import_Ajax.php index 4b8609776..57f818678 100644 --- a/workflow/engine/methods/processes/processes_Import_Ajax.php +++ b/workflow/engine/methods/processes/processes_Import_Ajax.php @@ -70,7 +70,7 @@ if (PMLicensedFeatures::getSingleton()->verifyfeature("B0oWlBLY3hHdWY0YUNpZEtFQm if (!empty($arrayTrigger)) { - $cs = new CodeScanner(SYS_SYS); + $cs = new CodeScanner(config("sys_sys")); $strFoundDisabledCode = ""; diff --git a/workflow/engine/methods/processes/processes_webEntryGenerate.php b/workflow/engine/methods/processes/processes_webEntryGenerate.php index 1767fcf2f..d3008c1e4 100644 --- a/workflow/engine/methods/processes/processes_webEntryGenerate.php +++ b/workflow/engine/methods/processes/processes_webEntryGenerate.php @@ -68,8 +68,8 @@ try { $pluginTpl = PATH_CORE . 'templates' . PATH_SEP . 'processes' . PATH_SEP . 'webentryPost.tpl'; $template = new TemplatePower( $pluginTpl ); $template->prepare(); - $template->assign( 'wsdlUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2' ); - $template->assign( 'wsUploadUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/upload' ); + $template->assign( 'wsdlUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2' ); + $template->assign( 'wsUploadUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/upload' ); $template->assign( 'processUid', $sPRO_UID ); $template->assign( 'dynaformUid', $sDYNAFORM ); $template->assign( 'taskUid', $sTASKS ); @@ -88,7 +88,7 @@ try { $template->assign( 'dynaform', $dynTitle ); $template->assign( 'timestamp', date( 'l jS \of F Y h:i:s A' ) ); - $template->assign( 'ws', SYS_SYS ); + $template->assign( 'ws', config("sys_sys") ); $template->assign( 'version', System::getVersion() ); $fileName = $pathProcess . $dynTitle . 'Post.php'; @@ -134,13 +134,13 @@ try { $aDataEvent['EVN_CONDITIONS'] = $sWS_USER; $output = $oEvent->update( $aDataEvent ); //Show link - $link = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $sPRO_UID . '/' . $dynTitle . '.php'; + $link = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $sPRO_UID . '/' . $dynTitle . '.php'; print $link; //print "\n $link "; } else { $G_FORM = new Form( $sPRO_UID . '/' . $sDYNAFORM, PATH_DYNAFORM, SYS_LANG, false ); - $G_FORM->action = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/cases_StartExternal.php'; + $G_FORM->action = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/cases_StartExternal.php'; $scriptCode = ''; $scriptCode = $G_FORM->render( PATH_CORE . 'templates/' . 'xmlform' . '.html', $scriptCode ); @@ -158,7 +158,7 @@ try { $template->assign("URL_MABORAK_JS", G::browserCacheFilesUrl("/js/maborak/core/maborak.js")); $template->assign("URL_TRANSLATION_ENV_JS", G::browserCacheFilesUrl("/jscore/labels/" . SYS_LANG . ".js")); $template->assign("siteUrl", $http . $_SERVER["HTTP_HOST"]); - $template->assign("sysSys", SYS_SYS); + $template->assign("sysSys", config("sys_sys")); $template->assign("sysLang", SYS_LANG); $template->assign("sysSkin", SYS_SKIN); $template->assign("processUid", $sPRO_UID); diff --git a/workflow/engine/methods/processes/processes_webEntryValidate.php b/workflow/engine/methods/processes/processes_webEntryValidate.php index bffe4fa91..c4056cd20 100644 --- a/workflow/engine/methods/processes/processes_webEntryValidate.php +++ b/workflow/engine/methods/processes/processes_webEntryValidate.php @@ -29,7 +29,7 @@ if (G::is_https()) { $http = 'http://'; } -$endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; +$endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; $client = new SoapClient( $endpoint, $streamContext ); $user = $sWS_USER; diff --git a/workflow/engine/methods/processes/webEntry_Val_Assig.php b/workflow/engine/methods/processes/webEntry_Val_Assig.php index a5230d349..ae813ecc4 100644 --- a/workflow/engine/methods/processes/webEntry_Val_Assig.php +++ b/workflow/engine/methods/processes/webEntry_Val_Assig.php @@ -14,7 +14,7 @@ if (G::is_https()) else $http = 'http://'; -$endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; +$endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; @$client = new SoapClient( $endpoint ); $oTask = new Task(); diff --git a/workflow/engine/methods/services/webdav.php b/workflow/engine/methods/services/webdav.php index b833a51bc..9c7ef8e7c 100644 --- a/workflow/engine/methods/services/webdav.php +++ b/workflow/engine/methods/services/webdav.php @@ -37,7 +37,7 @@ function AuthenticationBasicHTTP ($realm) return false; } -$realm = 'ProcessMaker Filesystem for Workspace ' . SYS_SYS; +$realm = 'ProcessMaker Filesystem for Workspace ' . config("sys_sys"); # Choice an authentification type Digest or Basic //AuthenticationDigestHTTP($realm, $users, $phpcgi); diff --git a/workflow/engine/methods/services/wsdl2.php b/workflow/engine/methods/services/wsdl2.php index 5062aedef..29128f327 100644 --- a/workflow/engine/methods/services/wsdl2.php +++ b/workflow/engine/methods/services/wsdl2.php @@ -6,7 +6,7 @@ $content = file_get_contents($filewsdl); $http = G::is_https() ? 'https' : 'http'; $port = $_SERVER['SERVER_PORT'] === '80' ? '' : ':' . $_SERVER['SERVER_PORT']; $lang = defined('SYS_LANG') ? SYS_LANG : 'en'; -$endpoint = $http . '://' . $_SERVER['SERVER_NAME'] . $port . '/sys' . SYS_SYS . '/' . $lang . '/neoclassic/services/soap2'; +$endpoint = $http . '://' . $_SERVER['SERVER_NAME'] . $port . '/sys' . config("sys_sys") . '/' . $lang . '/neoclassic/services/soap2'; $content = str_replace("___SOAP_ADDRESS___", $endpoint, $content); diff --git a/workflow/engine/methods/setup/auditLogAjax.php b/workflow/engine/methods/setup/auditLogAjax.php index 236db9265..c54fe5487 100644 --- a/workflow/engine/methods/setup/auditLogAjax.php +++ b/workflow/engine/methods/setup/auditLogAjax.php @@ -110,7 +110,7 @@ $response = array (); switch ($option) { case "LST": $pageSize = $_REQUEST["pageSize"]; - $workspace = SYS_SYS; + $workspace = config("sys_sys"); $action = $_REQUEST["action"]; $description = $_REQUEST["description"]; $dateFrom = $_REQUEST["dateFrom"]; diff --git a/workflow/engine/methods/setup/cronAjax.php b/workflow/engine/methods/setup/cronAjax.php index 623f2355f..801c7eff4 100644 --- a/workflow/engine/methods/setup/cronAjax.php +++ b/workflow/engine/methods/setup/cronAjax.php @@ -116,7 +116,7 @@ $response = array (); switch ($option) { case "LST": $pageSize = $_REQUEST["pageSize"]; - $workspace = SYS_SYS; + $workspace = config("sys_sys"); $status = $_REQUEST["status"]; $dateFrom = $_REQUEST["dateFrom"]; $dateTo = $_REQUEST["dateTo"]; diff --git a/workflow/engine/methods/setup/languages_Import.php b/workflow/engine/methods/setup/languages_Import.php index fdda4812b..cceae2892 100644 --- a/workflow/engine/methods/setup/languages_Import.php +++ b/workflow/engine/methods/setup/languages_Import.php @@ -78,7 +78,7 @@ try { $configuration = new Configurations(); $importResults = $language->import( $languageFile ); - $renegerateContent = new WorkspaceTools( SYS_SYS ); + $renegerateContent = new WorkspaceTools( config("sys_sys") ); $messs = $renegerateContent->upgradeContent(); $result->msg = G::LoadTranslation( 'IMPORT_LANGUAGE_SUCCESS' ) . "\n"; diff --git a/workflow/engine/methods/setup/loginSettingsAjax.php b/workflow/engine/methods/setup/loginSettingsAjax.php index 96bbd1319..83a375f31 100644 --- a/workflow/engine/methods/setup/loginSettingsAjax.php +++ b/workflow/engine/methods/setup/loginSettingsAjax.php @@ -19,7 +19,7 @@ switch ($request) { print (G::json_encode( $result )) ; break; case 'saveSettings': - $memcache = & PMmemcached::getSingleton( defined( 'SYS_SYS' ) ? SYS_SYS : '' ); + $memcache = & PMmemcached::getSingleton( defined( 'SYS_SYS' ) ? config("sys_sys") : '' ); $conf = new Configurations(); $conf->loadConfig( $obj, 'ENVIRONMENT_SETTINGS', '' ); diff --git a/workflow/engine/methods/setup/pluginsChange.php b/workflow/engine/methods/setup/pluginsChange.php index df188b24f..df10a45ad 100644 --- a/workflow/engine/methods/setup/pluginsChange.php +++ b/workflow/engine/methods/setup/pluginsChange.php @@ -56,7 +56,7 @@ if ($handle = opendir(PATH_PLUGINS)) { ) { //Check disabled code - $cs = new CodeScanner(SYS_SYS); + $cs = new CodeScanner(config("sys_sys")); $arrayFoundDisabledCode = array_merge( $cs->checkDisabledCode("FILE", PATH_PLUGINS . $pluginName . ".php"), diff --git a/workflow/engine/methods/setup/pluginsImportFile.php b/workflow/engine/methods/setup/pluginsImportFile.php index 51f29c8ef..863bb3f07 100644 --- a/workflow/engine/methods/setup/pluginsImportFile.php +++ b/workflow/engine/methods/setup/pluginsImportFile.php @@ -251,7 +251,7 @@ try { if (PMLicensedFeatures::getSingleton()->verifyfeature("B0oWlBLY3hHdWY0YUNpZEtFQm5CeTJhQlIwN3IxMEkwaG4=")) { //Check disabled code - $cs = new CodeScanner(SYS_SYS); + $cs = new CodeScanner(config("sys_sys")); $arrayFoundDisabledCode = array_merge($cs->checkDisabledCode("FILE", $path . $pluginFile), $cs->checkDisabledCode("PATH", $path . $sClassName)); diff --git a/workflow/engine/methods/setup/pluginsList.php b/workflow/engine/methods/setup/pluginsList.php index 2da7e3ad7..19aac663e 100644 --- a/workflow/engine/methods/setup/pluginsList.php +++ b/workflow/engine/methods/setup/pluginsList.php @@ -24,5 +24,5 @@ */ $RBAC->requirePermissions('PM_SETUP_ADVANCE'); -$items = \PMPlugin::getListPluginsManager(SYS_SYS); +$items = \PMPlugin::getListPluginsManager(config("sys_sys")); echo G::json_encode($items); diff --git a/workflow/engine/methods/setup/pluginsMain.php b/workflow/engine/methods/setup/pluginsMain.php index 8848fb917..f7ef645e1 100644 --- a/workflow/engine/methods/setup/pluginsMain.php +++ b/workflow/engine/methods/setup/pluginsMain.php @@ -30,7 +30,7 @@ $RBAC->requirePermissions( 'PM_SETUP' ); $headPublisher = & headPublisher::getSingleton(); $headPublisher->addExtJsScript( 'setup/pluginsMain', false ); -$headPublisher->assign( "PROCESSMAKER_URL", "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN ); +$headPublisher->assign( "PROCESSMAKER_URL", "/sys" . config("sys_sys") . "/" . SYS_LANG . "/" . SYS_SKIN ); $headPublisher->assign( "SYS_SKIN", SYS_SKIN ); $oPluginRegistry = PluginRegistry::loadSingleton(); diff --git a/workflow/engine/methods/setup/replacementLogo.php b/workflow/engine/methods/setup/replacementLogo.php index 82b94d3a2..7f3318c2b 100644 --- a/workflow/engine/methods/setup/replacementLogo.php +++ b/workflow/engine/methods/setup/replacementLogo.php @@ -63,7 +63,7 @@ try { //ini_set('display_errors','1'); $snameLogo = changeNamelogo( $snameLogo ); $oConf = new Configurations(); - $aConf = Array ('WORKSPACE_LOGO_NAME' => SYS_SYS,'DEFAULT_LOGO_NAME' => $snameLogo + $aConf = Array ('WORKSPACE_LOGO_NAME' => config("sys_sys"),'DEFAULT_LOGO_NAME' => $snameLogo ); $oConf->aConfig = $aConf; diff --git a/workflow/engine/methods/setup/skin_Ajax.php b/workflow/engine/methods/setup/skin_Ajax.php index 9e893680b..8c07bdca6 100644 --- a/workflow/engine/methods/setup/skin_Ajax.php +++ b/workflow/engine/methods/setup/skin_Ajax.php @@ -162,7 +162,7 @@ function newSkin ($baseSkin = 'classic') $xmlConfiguration = file_get_contents( $configFileOriginal ); - $workspace = ($_REQUEST['workspace'] == 'global') ? '' : SYS_SYS; + $workspace = ($_REQUEST['workspace'] == 'global') ? '' : config("sys_sys"); $xmlConfigurationObj = G::xmlParser($xmlConfiguration); $skinInformationArray = $xmlConfigurationObj->result["skinConfiguration"]["__CONTENT__"]["information"]["__CONTENT__"]; @@ -282,7 +282,7 @@ function importSkin () $configFileFinal = PATH_CUSTOM_SKINS . $skinName . PATH_SEP . 'config.xml'; $xmlConfiguration = file_get_contents( $configFileOriginal ); - $workspace = ($_REQUEST['workspace'] == 'global') ? '' : SYS_SYS; + $workspace = ($_REQUEST['workspace'] == 'global') ? '' : config("sys_sys"); $xmlConfigurationObj = G::xmlParser($xmlConfiguration); $skinInformationArray = $xmlConfigurationObj->result["skinConfiguration"]["__CONTENT__"]["information"]["__CONTENT__"]; diff --git a/workflow/engine/methods/setup/skinsList.php b/workflow/engine/methods/setup/skinsList.php index 4bde6da13..5c81e9ffa 100644 --- a/workflow/engine/methods/setup/skinsList.php +++ b/workflow/engine/methods/setup/skinsList.php @@ -44,7 +44,7 @@ $oHeadPublisher->addExtJsScript( 'setup/skinList', false ); //adding a javascrip $oHeadPublisher->addContent( 'setup/skinList' ); //adding a html file .html. $oHeadPublisher->assign( 'CONFIG', $Config ); $oHeadPublisher->assign( 'SYS_SKIN', SYS_SKIN ); -$oHeadPublisher->assign( 'SYS_SYS', "sys".SYS_SYS ); +$oHeadPublisher->assign( 'SYS_SYS', "sys".config("sys_sys") ); $oHeadPublisher->assign( 'FORMATS', $c->getFormats() ); diff --git a/workflow/engine/methods/setup/webServicesAjax.php b/workflow/engine/methods/setup/webServicesAjax.php index 788e6518c..49e4315d7 100644 --- a/workflow/engine/methods/setup/webServicesAjax.php +++ b/workflow/engine/methods/setup/webServicesAjax.php @@ -66,7 +66,7 @@ switch ($_POST['action']) { if (! isset( $_SESSION['END_POINT'] )) { $aFields['WS_HOST'] = $_SERVER['HTTP_HOST']; - $aFields['WS_WORKSPACE'] = SYS_SYS; + $aFields['WS_WORKSPACE'] = config("sys_sys"); } else { if (strpos( $_SESSION['END_POINT'], 'https' ) !== false) { preg_match( '@^(?:https://)?([^/]+)@i', $_SESSION['END_POINT'], $coincidencias ); @@ -94,15 +94,15 @@ switch ($_POST['action']) { $_SESSION['_DBArray'] = $_DBArray; if (! isset( $_SESSION['END_POINT'] )) { - //$wsdl = 'http://'.$_SERVER['HTTP_HOST'].'/sys'.SYS_SYS. '/'. SYS_LANG .'/classic/services/wsdl'; + //$wsdl = 'http://'.$_SERVER['HTTP_HOST'].'/sys'.config("sys_sys"). '/'. SYS_LANG .'/classic/services/wsdl'; $wsdl = 'http://' . $_SERVER['HTTP_HOST']; - $workspace = SYS_SYS; + $workspace = config("sys_sys"); } else { $wsdl = $_SESSION['END_POINT']; $workspace = $_SESSION['WS_WORKSPACE']; } - $defaultEndpoint = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/classic/services/wsdl2'; + $defaultEndpoint = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/classic/services/wsdl2'; $wsdl = isset( $_SESSION['END_POINT'] ) ? $_SESSION['END_POINT'] : $defaultEndpoint; @@ -144,7 +144,7 @@ try { if (isset( $_POST["epr"] )) { $_SESSION['END_POINT'] = $_POST["epr"]; } - $defaultEndpoint = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/classic/services/wsdl2'; + $defaultEndpoint = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/classic/services/wsdl2'; $endpoint = isset( $_SESSION['END_POINT'] ) ? $_SESSION['END_POINT'] : $defaultEndpoint; @@ -616,7 +616,7 @@ try { $caseNumber = $oCases->getAppNumber(); // generating the path for the template msj - $templateFile = PATH_DB . SYS_SYS . PATH_SEP . 'mailTemplates' . PATH_SEP . $proUid . PATH_SEP . 'tempTemplate.hml'; + $templateFile = PATH_DB . config("sys_sys") . PATH_SEP . 'mailTemplates' . PATH_SEP . $proUid . PATH_SEP . 'tempTemplate.hml'; // generating the file adding the msj variable $messageBody = "message for case: " . $caseNumber . "
" . $message; file_put_contents( $templateFile, $messageBody ); @@ -1461,7 +1461,7 @@ try { function sendFile ($FILENAME, $USR_UID, $APP_UID, $DEL_INDEX = 1, $DOC_UID = null, $title = null, $comment = null) { - $defaultEndpoint = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/classic/services/upload'; + $defaultEndpoint = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/classic/services/upload'; $upload = isset( $_SESSION['END_POINT'] ) ? $_SESSION['END_POINT'] : $defaultEndpoint; $DOC_UID = ($DOC_UID != null) ? $DOC_UID : - 1; diff --git a/workflow/engine/methods/setup/webServicesSetup.php b/workflow/engine/methods/setup/webServicesSetup.php index 71d2df3df..6a59b5aaa 100644 --- a/workflow/engine/methods/setup/webServicesSetup.php +++ b/workflow/engine/methods/setup/webServicesSetup.php @@ -29,7 +29,7 @@ $ses = new DBSession( $dbc ); if (! isset( $_SESSION['END_POINT'] )) { $aFields['WS_HOST'] = $_SERVER['HTTP_HOST']; - $aFields['WS_WORKSPACE'] = SYS_SYS; + $aFields['WS_WORKSPACE'] = config("sys_sys"); } else { if (strpos( $_SESSION['END_POINT'], 'https' ) !== false) { preg_match( '@^(?:https://)?([^/]+)@i', $_SESSION['END_POINT'], $coincidencias ); diff --git a/workflow/engine/methods/tracker/tracker_ShowDocument.php b/workflow/engine/methods/tracker/tracker_ShowDocument.php index 8837cdd5b..433258afe 100644 --- a/workflow/engine/methods/tracker/tracker_ShowDocument.php +++ b/workflow/engine/methods/tracker/tracker_ShowDocument.php @@ -65,8 +65,8 @@ if (! $sw_file_exists) { print G::json_encode( $res ); } else { G::SendMessageText( $error_message, "ERROR" ); - $backUrlObj = explode( "sys" . SYS_SYS, $_SERVER['HTTP_REFERER'] ); - G::header( "location: " . "/sys" . SYS_SYS . $backUrlObj[1] ); + $backUrlObj = explode( "sys" . config("sys_sys"), $_SERVER['HTTP_REFERER'] ); + G::header( "location: " . "/sys" . config("sys_sys") . $backUrlObj[1] ); die(); } diff --git a/workflow/engine/methods/tracker/tracker_ShowOutputDocument.php b/workflow/engine/methods/tracker/tracker_ShowOutputDocument.php index 4aba2f5bd..7d85300ea 100644 --- a/workflow/engine/methods/tracker/tracker_ShowOutputDocument.php +++ b/workflow/engine/methods/tracker/tracker_ShowOutputDocument.php @@ -68,8 +68,8 @@ if (! $sw_file_exists) { print G::json_encode( $res ); } else { G::SendMessageText( $error_message, "ERROR" ); - $backUrlObj = explode( "sys" . SYS_SYS, $_SERVER['HTTP_REFERER'] ); - G::header( "location: " . "/sys" . SYS_SYS . $backUrlObj[1] ); + $backUrlObj = explode( "sys" . config("sys_sys"), $_SERVER['HTTP_REFERER'] ); + G::header( "location: " . "/sys" . config("sys_sys") . $backUrlObj[1] ); die(); } diff --git a/workflow/engine/methods/triggers/triggers_Save.php b/workflow/engine/methods/triggers/triggers_Save.php index 7f23af6c5..8499506a5 100644 --- a/workflow/engine/methods/triggers/triggers_Save.php +++ b/workflow/engine/methods/triggers/triggers_Save.php @@ -61,7 +61,7 @@ if (isset( $sfunction ) && $sfunction == 'lookforNameTrigger') { ) { //Check disabled code - $cs = new CodeScanner(SYS_SYS); + $cs = new CodeScanner(config("sys_sys")); $arrayFoundDisabledCode = $cs->checkDisabledCode("SOURCE", $value["TRI_WEBBOT"]); diff --git a/workflow/engine/methods/users/usersEdit.php b/workflow/engine/methods/users/usersEdit.php index 4148507e2..9117dead4 100644 --- a/workflow/engine/methods/users/usersEdit.php +++ b/workflow/engine/methods/users/usersEdit.php @@ -33,7 +33,7 @@ if ($licensedFeatures->verifyfeature('w2LL3o4NFNiaDRXcFFCYVpJS3Jsall5dmh0ZWtBTkd } /*----------------------------------********---------------------------------*/ -$arraySystemConfiguration = System::getSystemConfiguration('', '', SYS_SYS); +$arraySystemConfiguration = System::getSystemConfiguration('', '', config("sys_sys")); $oHeadPublisher = & headPublisher::getSingleton(); $oHeadPublisher->addExtJsScript( 'users/users', true ); //adding a javascript file .js diff --git a/workflow/engine/methods/users/usersInit.php b/workflow/engine/methods/users/usersInit.php index 208d1197c..4ef45d52a 100644 --- a/workflow/engine/methods/users/usersInit.php +++ b/workflow/engine/methods/users/usersInit.php @@ -48,7 +48,7 @@ if ($licensedFeatures->verifyfeature('w2LL3o4NFNiaDRXcFFCYVpJS3Jsall5dmh0ZWtBTkd } /*----------------------------------********---------------------------------*/ -$arraySystemConfiguration = System::getSystemConfiguration('', '', SYS_SYS); +$arraySystemConfiguration = System::getSystemConfiguration('', '', config("sys_sys")); $oHeadPublisher = & headPublisher::getSingleton(); $oHeadPublisher->addExtJsScript( 'users/users', true ); //adding a javascript file .js diff --git a/workflow/engine/methods/users/usersNew.php b/workflow/engine/methods/users/usersNew.php index b73bf00d3..6d65ea23e 100644 --- a/workflow/engine/methods/users/usersNew.php +++ b/workflow/engine/methods/users/usersNew.php @@ -38,7 +38,7 @@ if ($licensedFeatures->verifyfeature('w2LL3o4NFNiaDRXcFFCYVpJS3Jsall5dmh0ZWtBTkd } /*----------------------------------********---------------------------------*/ -$arraySystemConfiguration = System::getSystemConfiguration('', '', SYS_SYS); +$arraySystemConfiguration = System::getSystemConfiguration('', '', config("sys_sys")); $oHeadPublisher = & headPublisher::getSingleton(); $oHeadPublisher->addExtJsScript( 'users/users', true ); //adding a javascript file .js diff --git a/workflow/engine/plugins/openFlash/class.openFlash.php b/workflow/engine/plugins/openFlash/class.openFlash.php index 381f9a089..6635599ed 100644 --- a/workflow/engine/plugins/openFlash/class.openFlash.php +++ b/workflow/engine/plugins/openFlash/class.openFlash.php @@ -56,7 +56,7 @@ function getChart( $chartName ) { $this->readConfig(); - $prePath = '/sys' . SYS_SYS . '/' . SYS_LANG . '/blank/'; + $prePath = '/sys' . config("sys_sys") . '/' . SYS_LANG . '/blank/'; $obj = new StdClass(); $obj->title = 'Standard ProcessMaker Reports'; $obj->height = 220; diff --git a/workflow/engine/plugins/pmosCommunity/class.pmosCommunity.php b/workflow/engine/plugins/pmosCommunity/class.pmosCommunity.php index f769d6bd6..085ea2264 100644 --- a/workflow/engine/plugins/pmosCommunity/class.pmosCommunity.php +++ b/workflow/engine/plugins/pmosCommunity/class.pmosCommunity.php @@ -56,7 +56,7 @@ function getChart( $chartName ) { $this->readConfig(); - $prePath = '/sys' . SYS_SYS . '/' . SYS_LANG . '/blank/'; + $prePath = '/sys' . config("sys_sys") . '/' . SYS_LANG . '/blank/'; $obj = new StdClass(); switch ($chartName) { case 'PostByForum': diff --git a/workflow/engine/skinEngine/skinEngine.php b/workflow/engine/skinEngine/skinEngine.php index 61f0e37a4..da6f21d2c 100644 --- a/workflow/engine/skinEngine/skinEngine.php +++ b/workflow/engine/skinEngine/skinEngine.php @@ -342,7 +342,7 @@ class SkinEngine } $smarty->assign('username', - (isset($_SESSION['USR_USERNAME']) ? '(' . $_SESSION['USR_USERNAME'] . ' ' . G::LoadTranslation('ID_IN') . ' ' . SYS_SYS . ')' : '')); + (isset($_SESSION['USR_USERNAME']) ? '(' . $_SESSION['USR_USERNAME'] . ' ' . G::LoadTranslation('ID_IN') . ' ' . config("sys_sys") . ')' : '')); $smarty->assign('header', $header); $smarty->force_compile = $this->forceTemplateCompile; @@ -378,7 +378,7 @@ class SkinEngine $header = ''; if (isset($oHeadPublisher)) { - $oHeadPublisher->title = isset($_SESSION['USR_USERNAME']) ? '(' . $_SESSION['USR_USERNAME'] . ' ' . G::LoadTranslation('ID_IN') . ' ' . SYS_SYS . ')' : ''; + $oHeadPublisher->title = isset($_SESSION['USR_USERNAME']) ? '(' . $_SESSION['USR_USERNAME'] . ' ' . G::LoadTranslation('ID_IN') . ' ' . config("sys_sys") . ')' : ''; $header = $oHeadPublisher->printHeader(); $header .= $oHeadPublisher->getExtJsStylesheets($this->cssFileName); } @@ -436,7 +436,7 @@ class SkinEngine $smarty->assign('rolename', isset($_SESSION['USR_ROLENAME']) ? $_SESSION['USR_ROLENAME'] . '' : ''); $smarty->assign('pipe', isset($_SESSION['USR_USERNAME']) ? ' | ' : ''); $smarty->assign('logout', G::LoadTranslation('ID_LOGOUT')); - $smarty->assign('workspace', defined('SYS_SYS') ? SYS_SYS : ''); + $smarty->assign('workspace', defined('SYS_SYS') ? config("sys_sys") : ''); $uws = (isset($_SESSION['USR_ROLENAME']) && $_SESSION['USR_ROLENAME'] != '') ? strtolower(G::LoadTranslation('ID_WORKSPACE_USING')) : G::LoadTranslation('ID_WORKSPACE_USING'); $smarty->assign('workspace_label', $uws); @@ -449,7 +449,7 @@ class SkinEngine } if (defined('SYS_SYS')) { - $logout = '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/login/login'; + $logout = '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/login/login'; } else { $logout = '/sys/' . SYS_LANG . '/' . SYS_SKIN . '/login/login'; } @@ -494,7 +494,7 @@ class SkinEngine $header = ''; if (isset($oHeadPublisher)) { - $oHeadPublisher->title = isset($_SESSION['USR_USERNAME']) ? '(' . $_SESSION['USR_USERNAME'] . ' ' . G::LoadTranslation('ID_IN') . ' ' . SYS_SYS . ')' : ''; + $oHeadPublisher->title = isset($_SESSION['USR_USERNAME']) ? '(' . $_SESSION['USR_USERNAME'] . ' ' . G::LoadTranslation('ID_IN') . ' ' . config("sys_sys") . ')' : ''; $header = $oHeadPublisher->printHeader(); } @@ -695,7 +695,7 @@ class SkinEngine if (isset($oHeadPublisher)) { if (defined('SYS_SYS')) { - $oHeadPublisher->title = isset($_SESSION['USR_USERNAME']) ? '(' . $_SESSION['USR_USERNAME'] . ' ' . G::LoadTranslation('ID_IN') . ' ' . SYS_SYS . ')' : ''; + $oHeadPublisher->title = isset($_SESSION['USR_USERNAME']) ? '(' . $_SESSION['USR_USERNAME'] . ' ' . G::LoadTranslation('ID_IN') . ' ' . config("sys_sys") . ')' : ''; } $header = $enableJsScript ? $oHeadPublisher->printHeader() : ''; $header .= $oHeadPublisher->getExtJsStylesheets($this->cssFileName); @@ -765,7 +765,7 @@ class SkinEngine $smarty->assign('rolename', isset($_SESSION['USR_ROLENAME']) ? $_SESSION['USR_ROLENAME'] . '' : ''); $smarty->assign('pipe', isset($_SESSION['USR_USERNAME']) ? ' | ' : ''); $smarty->assign('logout', G::LoadTranslation('ID_LOGOUT')); - $smarty->assign('workspace', defined('SYS_SYS') ? SYS_SYS : ''); + $smarty->assign('workspace', defined('SYS_SYS') ? config("sys_sys") : ''); $uws = (isset($_SESSION['USR_ROLENAME']) && $_SESSION['USR_ROLENAME'] != '') ? strtolower(G::LoadTranslation('ID_WORKSPACE_USING')) : G::LoadTranslation('ID_WORKSPACE_USING'); $smarty->assign('workspace_label', $uws); @@ -794,7 +794,7 @@ class SkinEngine } if (defined('SYS_SYS')) { - $logout = "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . ((SYS_COLLECTION != "tracker") ? "/login/login" : "/tracker/login"); + $logout = "/sys" . config("sys_sys") . "/" . SYS_LANG . "/" . SYS_SKIN . ((SYS_COLLECTION != "tracker") ? "/login/login" : "/tracker/login"); } else { $logout = '/sys/' . SYS_LANG . '/' . SYS_SKIN . '/login/login'; } @@ -816,9 +816,9 @@ class SkinEngine } if (class_exists('ProcessMaker\Plugins\PluginRegistry') && defined("SYS_SYS")) { $oPluginRegistry = PluginRegistry::loadSingleton(); - if (isset($sFotoSelect) && $sFotoSelect != '' && !(strcmp($sWspaceSelect, SYS_SYS))) { + if (isset($sFotoSelect) && $sFotoSelect != '' && !(strcmp($sWspaceSelect, config("sys_sys")))) { $sCompanyLogo = $oPluginRegistry->getCompanyLogo($sFotoSelect); - $sCompanyLogo = "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/setup/showLogoFile.php?id=" . base64_encode($sCompanyLogo); + $sCompanyLogo = "/sys" . config("sys_sys") . "/" . SYS_LANG . "/" . SYS_SKIN . "/setup/showLogoFile.php?id=" . base64_encode($sCompanyLogo); } else { $sCompanyLogo = $oPluginRegistry->getCompanyLogo('/images/processmaker.logo.jpg'); } diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/ActionsByEmail.php b/workflow/engine/src/ProcessMaker/BusinessModel/ActionsByEmail.php index fb0c7b3dd..7443c2e2d 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/ActionsByEmail.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/ActionsByEmail.php @@ -724,7 +724,7 @@ class ActionsByEmail if ($flagLogin) { header( - 'Location: /sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . + 'Location: /sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/login/login?u=' . urlencode($_SERVER['REQUEST_URI']) ); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php b/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php index 938a61b01..12f6499ef 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php @@ -3177,7 +3177,7 @@ class Cases } $arrayApplicationData['APP_DATA'][$key] = G::json_encode($files); } catch (Exception $e) { - Bootstrap::registerMonolog('DeleteFile', 400, $e->getMessage(), $value, SYS_SYS, 'processmaker.log'); + Bootstrap::registerMonolog('DeleteFile', 400, $e->getMessage(), $value, config("sys_sys"), 'processmaker.log'); } } $flagDelete = true; diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Cases/InputDocument.php b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/InputDocument.php index 853095c30..6eb951953 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Cases/InputDocument.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/InputDocument.php @@ -802,8 +802,8 @@ class InputDocument break; } G::SendMessageText( $message, "ERROR" ); - $backUrlObj = explode( "sys" . SYS_SYS, $_SERVER['HTTP_REFERER'] ); - G::header( "location: " . "/sys" . SYS_SYS . $backUrlObj[1] ); + $backUrlObj = explode( "sys" . config("sys_sys"), $_SERVER['HTTP_REFERER'] ); + G::header( "location: " . "/sys" . config("sys_sys") . $backUrlObj[1] ); die(); } @@ -855,9 +855,9 @@ class InputDocument if ($msg != '') { if ($runningWorkflow) { G::SendMessageText($msg, 'ERROR'); - $backUrlObj = explode('sys' . SYS_SYS, $_SERVER['HTTP_REFERER']); + $backUrlObj = explode('sys' . config("sys_sys"), $_SERVER['HTTP_REFERER']); - G::header('location: ' . '/sys' . SYS_SYS . $backUrlObj[1]); + G::header('location: ' . '/sys' . config("sys_sys") . $backUrlObj[1]); exit(0); } else { throw new Exception($msg); @@ -1005,8 +1005,8 @@ class InputDocument } $message = $res->message; G::SendMessageText($message, "ERROR"); - $backUrlObj = explode("sys" . SYS_SYS, $_SERVER['HTTP_REFERER']); - G::header("location: " . "/sys" . SYS_SYS . $backUrlObj[1]); + $backUrlObj = explode("sys" . config("sys_sys"), $_SERVER['HTTP_REFERER']); + G::header("location: " . "/sys" . config("sys_sys") . $backUrlObj[1]); die(); } @@ -1019,8 +1019,8 @@ class InputDocument if ($inpDocMaxFilesize > 0 && $fileSizeByField > 0) { if ($fileSizeByField > $inpDocMaxFilesize) { G::SendMessageText(G::LoadTranslation("ID_SIZE_VERY_LARGE_PERMITTED"), "ERROR"); - $arrayAux1 = explode("sys" . SYS_SYS, $_SERVER["HTTP_REFERER"]); - G::header("location: /sys" . SYS_SYS . $arrayAux1[1]); + $arrayAux1 = explode("sys" . config("sys_sys"), $_SERVER["HTTP_REFERER"]); + G::header("location: /sys" . config("sys_sys") . $arrayAux1[1]); exit(0); } } @@ -1035,8 +1035,8 @@ class InputDocument $message = G::LoadTranslation('THE_UPLOAD_OF_PHP_FILES_WAS_DISABLED'); Bootstrap::registerMonologPhpUploadExecution('phpUpload', 550, $message, 'processmaker.log'); G::SendMessageText($message, "ERROR"); - $backUrlObj = explode("sys" . SYS_SYS, $_SERVER['HTTP_REFERER']); - G::header("location: " . "/sys" . SYS_SYS . $backUrlObj[1]); + $backUrlObj = explode("sys" . config("sys_sys"), $_SERVER['HTTP_REFERER']); + G::header("location: " . "/sys" . config("sys_sys") . $backUrlObj[1]); die(); } diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Consolidated.php b/workflow/engine/src/ProcessMaker/BusinessModel/Consolidated.php index c53b794c0..38ae8f8d9 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Consolidated.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Consolidated.php @@ -281,7 +281,7 @@ class Consolidated $className = $tableName; if (!class_exists($className)) { - require_once(PATH_DB . SYS_SYS . PATH_SEP . "classes" . PATH_SEP . $className . ".php"); + require_once(PATH_DB . config("sys_sys") . PATH_SEP . "classes" . PATH_SEP . $className . ".php"); } $oCriteria = new Criteria("workflow"); @@ -908,7 +908,7 @@ class Consolidated } } - @unlink(PATH_C . "ws" . PATH_SEP . SYS_SYS . PATH_SEP . "xmlform" . PATH_SEP . $pro_uid . PATH_SEP . $dyn_uid . "." . SYS_LANG); + @unlink(PATH_C . "ws" . PATH_SEP . config("sys_sys") . PATH_SEP . "xmlform" . PATH_SEP . $pro_uid . PATH_SEP . $dyn_uid . "." . SYS_LANG); $array ['columnModel'] = $caseColumns; diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/EmailEvent.php b/workflow/engine/src/ProcessMaker/BusinessModel/EmailEvent.php index 50fa3d84a..2edc1f423 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/EmailEvent.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/EmailEvent.php @@ -475,7 +475,7 @@ class EmailEvent \PMFSendMessage($appUID, $configEmailData['MESS_ACCOUNT'], $emailTo, '', '', $subject, $contentFile['prf_filename'], array(), array(), true, 0, $configEmailData); } else { - \Bootstrap::registerMonolog('EmailEventMailError', 200, \G::LoadTranslation('ID_EMAIL_EVENT_CONFIGURATION_EMAIL', array($eventUid, $prj_uid)), ['eventUid' => $eventUid, 'prj_uid' => $prj_uid], SYS_SYS, 'processmaker.log'); + \Bootstrap::registerMonolog('EmailEventMailError', 200, \G::LoadTranslation('ID_EMAIL_EVENT_CONFIGURATION_EMAIL', array($eventUid, $prj_uid)), ['eventUid' => $eventUid, 'prj_uid' => $prj_uid], config("sys_sys"), 'processmaker.log'); } } } diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/EmailServer.php b/workflow/engine/src/ProcessMaker/BusinessModel/EmailServer.php index 309562b79..3aac1c76a 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/EmailServer.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/EmailServer.php @@ -63,7 +63,7 @@ class EmailServer $currentUser = $RBAC->aUserInfo['USER_INFO']; $info = array( 'ip' => G::getIpAddress(), - 'workspace' => (defined("SYS_SYS")) ? SYS_SYS : "Workspace undefined", + 'workspace' => (defined("SYS_SYS")) ? config("sys_sys") : "Workspace undefined", 'usrUid' => $currentUser['USR_UID'] ); $this->setContextLog($info); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Light.php b/workflow/engine/src/ProcessMaker/BusinessModel/Light.php index 9a0025743..a5da9806b 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Light.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Light.php @@ -328,7 +328,7 @@ class Light //Log Bootstrap::registerMonolog('MobileCreateCase', 200, "Create case", - ['application_uid' => $aData['APPLICATION'], 'usr_uid' => $userId], SYS_SYS, 'processmaker.log'); + ['application_uid' => $aData['APPLICATION'], 'usr_uid' => $userId], config("sys_sys"), 'processmaker.log'); } catch (Exception $e) { $response['status'] = 'failure'; $response['message'] = $e->getMessage(); @@ -574,7 +574,7 @@ class Light //Log Bootstrap::registerMonolog('MobileRouteCase', 200, 'Route case', - ['application_uid' => $applicationUid, 'usr_uid' => $userUid], SYS_SYS, 'processmaker.log'); + ['application_uid' => $applicationUid, 'usr_uid' => $userUid], config("sys_sys"), 'processmaker.log'); } catch (Exception $e) { throw $e; } @@ -807,7 +807,7 @@ class Light session_start(); session_regenerate_id(); - setcookie("workspaceSkin", SYS_SKIN, time() + (24 * 60 * 60), "/sys" . SYS_SYS, null, false, true); + setcookie("workspaceSkin", SYS_SKIN, time() + (24 * 60 * 60), "/sys" . config("sys_sys"), null, false, true); if (strlen($msg) > 0) { $_SESSION['G_MESSAGE'] = $msg; @@ -1236,7 +1236,7 @@ class Light public function getUsersToReassign($usr_uid, $task_uid) { - $memcache = PMmemcached::getSingleton(SYS_SYS); + $memcache = PMmemcached::getSingleton(config("sys_sys")); $RBAC = RBAC::getSingleton(PATH_DATA, session_id()); $RBAC->sSystem = 'PROCESSMAKER'; $RBAC->initRBAC(); @@ -1323,7 +1323,7 @@ class Light */ public function getConfiguration($params) { - $sysConf = Bootstrap::getSystemConfiguration('', '', SYS_SYS); + $sysConf = Bootstrap::getSystemConfiguration('', '', config("sys_sys")); $multiTimeZone = false; //Set Time Zone /*----------------------------------********---------------------------------*/ diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Light/NotificationDevice.php b/workflow/engine/src/ProcessMaker/BusinessModel/Light/NotificationDevice.php index ec282273e..392611994 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Light/NotificationDevice.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Light/NotificationDevice.php @@ -12,7 +12,7 @@ class NotificationDevice public function checkMobileNotifications() { - $conf = System::getSystemConfiguration('', '', SYS_SYS); + $conf = System::getSystemConfiguration('', '', config("sys_sys")); $activeNotifications = true; if (isset($conf['mobileNotifications'])) { $activeNotifications = $conf['mobileNotifications'] == 1 ? true : false; diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/MessageApplication.php b/workflow/engine/src/ProcessMaker/BusinessModel/MessageApplication.php index de2e7614d..a0a649487 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/MessageApplication.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/MessageApplication.php @@ -371,7 +371,7 @@ class MessageApplication $ws = new \WsBase(); $case = new \Cases(); $common = new \ProcessMaker\Util\Common(); - $sysSys = (defined("SYS_SYS"))? SYS_SYS : "Undefined"; + $sysSys = (defined("SYS_SYS"))? config("sys_sys") : "Undefined"; $common->setFrontEnd($frontEnd); @@ -683,7 +683,7 @@ class MessageApplication ) { try { - \Bootstrap::registerMonolog('MessageEventCron', $level, $message, $aContext, SYS_SYS, 'processmaker.log'); + \Bootstrap::registerMonolog('MessageEventCron', $level, $message, $aContext, config("sys_sys"), 'processmaker.log'); } catch (\Exception $e) { throw $e; } diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/FileHandler.php b/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/FileHandler.php index bf4f9f757..f9e1ba397 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/FileHandler.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/FileHandler.php @@ -45,7 +45,7 @@ class FileHandler { $workflowFile = array(); $workspaceTargetDir = ($target === 'PUBLIC') ? 'public' : 'mailTemplates'; - $workspaceDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP; + $workspaceDir = PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP; $templatesDir = $workspaceDir . $workspaceTargetDir . PATH_SEP . $prj_uid; $templatesFiles = Util\Common::rglob("$templatesDir/*", 0, true); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/FilesMigrator.php b/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/FilesMigrator.php index f8f283a2a..5e1bf75c8 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/FilesMigrator.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/FilesMigrator.php @@ -44,7 +44,7 @@ class FilesMigrator implements Importable, Exportable } $aPath = $data['PATH']; foreach ($aPath as $target => $files) { - $basePath = PATH_DATA . 'sites' . PATH_SEP . SYS_SYS . PATH_SEP . 'public' . PATH_SEP; + $basePath = PATH_DATA . 'sites' . PATH_SEP . config("sys_sys") . PATH_SEP . 'public' . PATH_SEP; if (strtoupper($target) === 'PUBLIC') { foreach ($files as $file) { $filename = $basePath . ((isset($file["file_path"])) ? $file["file_path"] : $file["filepath"]); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/GranularExporter.php b/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/GranularExporter.php index c3b670abc..d815bfe84 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/GranularExporter.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/GranularExporter.php @@ -65,7 +65,7 @@ class GranularExporter $projectData = $bpmnProject->getProject(); $this->prjName = $projectData['PRJ_NAME']; $getProjectName = $this->publisher->truncateName($projectData['PRJ_NAME'], false); - $outputDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP; + $outputDir = PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP; $version = Common::getLastVersionSpecialCharacters($outputDir, $getProjectName, "pmx2") + 1; $outputFilename = $outputDir . sprintf("%s-%s.%s", str_replace(" ", "_", $getProjectName), $version, "pmx2"); @@ -143,7 +143,7 @@ class GranularExporter "export_server_os" => PHP_OS , "export_server_php_version" => PHP_VERSION_ID, ); - $data["metadata"]["workspace"] = defined("SYS_SYS") ? SYS_SYS : "Unknown"; + $data["metadata"]["workspace"] = defined("SYS_SYS") ? config("sys_sys") : "Unknown"; $data["metadata"]["name"] = $projectData['PRJ_NAME']; $data["metadata"]["uid"] = $projectData['PRJ_UID']; $data["metadata"]["export_version"] = $version; diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/TemplatesMigrator.php b/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/TemplatesMigrator.php index 0231d6bdb..5ba16f6d1 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/TemplatesMigrator.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/TemplatesMigrator.php @@ -44,7 +44,7 @@ class TemplatesMigrator implements Importable, Exportable } $aPath = $data['PATH']; foreach ($aPath as $target => $files) { - $basePath = PATH_DATA . 'sites' . PATH_SEP . SYS_SYS . PATH_SEP . 'mailTemplates' . PATH_SEP; + $basePath = PATH_DATA . 'sites' . PATH_SEP . config("sys_sys") . PATH_SEP . 'mailTemplates' . PATH_SEP; if (strtoupper($target) === 'TEMPLATE') { foreach ($files as $file) { $filename = $basePath . ((isset($file["file_path"])) ? $file["file_path"] : $file["filepath"]); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Process.php b/workflow/engine/src/ProcessMaker/BusinessModel/Process.php index 429661919..72a2cad01 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Process.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Process.php @@ -964,7 +964,7 @@ class Process $process = new \Process(); - $memcache = &\PMmemcached::getSingleton(SYS_SYS); + $memcache = &\PMmemcached::getSingleton(config("sys_sys")); $memkey = "no memcache"; $memcacheUsed = "not used"; @@ -1775,8 +1775,8 @@ class Process $aInvalidTypes = array("title", "subtitle", "file", "button", "reset", "submit", "javascript"); $aMultipleSelectionFields = array("listbox", "checkgroup", "grid"); - if (is_file( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/'. $proUid .'/'.$dynUid. '.xml' ) && filesize( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/'. $proUid .'/'. $dynUid .'.xml' ) > 0) { - $dyn = new DynaformHandler( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/' .$proUid. '/' . $dynUid .'.xml' ); + if (is_file( PATH_DATA . '/sites/'. config("sys_sys") .'/xmlForms/'. $proUid .'/'.$dynUid. '.xml' ) && filesize( PATH_DATA . '/sites/'. config("sys_sys") .'/xmlForms/'. $proUid .'/'. $dynUid .'.xml' ) > 0) { + $dyn = new DynaformHandler( PATH_DATA . '/sites/'. config("sys_sys") .'/xmlForms/' .$proUid. '/' . $dynUid .'.xml' ); $dynaformFields[] = $dyn->getFields(); $fields = $dyn->getFields(); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/ProjectUser.php b/workflow/engine/src/ProcessMaker/BusinessModel/ProjectUser.php index 624882cb9..7db2ee01d 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/ProjectUser.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/ProjectUser.php @@ -227,7 +227,7 @@ class ProjectUser } else { $http = 'http://'; } - $endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; + $endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; @$client = new \SoapClient( $endpoint ); $user = $sWS_USER; $pass = $sWS_PASS; @@ -325,7 +325,7 @@ class ProjectUser try { $http = (\G::is_https())? "https://" : "http://"; - $client = new \SoapClient($http . $_SERVER["HTTP_HOST"] . "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/services/wsdl2"); + $client = new \SoapClient($http . $_SERVER["HTTP_HOST"] . "/sys" . config("sys_sys") . "/" . SYS_LANG . "/" . SYS_SKIN . "/services/wsdl2"); $params = array( "userid" => $username, diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Skins.php b/workflow/engine/src/ProcessMaker/BusinessModel/Skins.php index a49bf9134..dcbbc0beb 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Skins.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Skins.php @@ -99,7 +99,7 @@ class Skins $xmlConfiguration = file_get_contents($configFileOriginal); - $workspace = ($skinWorkspace == 'global') ? '' : SYS_SYS; + $workspace = ($skinWorkspace == 'global') ? '' : config("sys_sys"); $xmlConfigurationObj = G::xmlParser($xmlConfiguration); $skinInformationArray = $xmlConfigurationObj->result["skinConfiguration"]["__CONTENT__"]["information"]["__CONTENT__"]; diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Table.php b/workflow/engine/src/ProcessMaker/BusinessModel/Table.php index 5b40de2cf..5b24829b0 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Table.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Table.php @@ -592,7 +592,7 @@ class Table } $className = $table['ADD_TAB_CLASS_NAME']; $classPeerName = $className . 'Peer'; - $sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP; + $sPath = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; if (! file_exists( $sPath . $className . '.php' )) { throw new \Exception( 'Update:: ' . G::loadTranslation( 'ID_PMTABLE_CLASS_DOESNT_EXIST', $className ) ); } @@ -684,7 +684,7 @@ class Table } $className = $table['ADD_TAB_CLASS_NAME']; $classPeerName = $className . 'Peer'; - $sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP; + $sPath = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; if (! file_exists( $sPath . $className . '.php' )) { throw new \Exception( 'Update:: ' . G::loadTranslation( 'ID_PMTABLE_CLASS_DOESNT_EXIST', $className ) ); } diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/TimerEvent.php b/workflow/engine/src/ProcessMaker/BusinessModel/TimerEvent.php index 3c840a7bb..6e3445beb 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/TimerEvent.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/TimerEvent.php @@ -1151,7 +1151,7 @@ class TimerEvent private function log($action, $value = "", $status = "action") { try { - $workspace = (defined("SYS_SYS"))? SYS_SYS : "Wokspace Undefined"; + $workspace = (defined("SYS_SYS"))? config("sys_sys") : "Wokspace Undefined"; $ipClient = \G::getIpAddress(); $actionTimer = "timereventcron: "; @@ -1192,7 +1192,7 @@ class TimerEvent ) { try { - \Bootstrap::registerMonolog('TimerEventCron', $level, $message, $aContext, SYS_SYS, 'processmaker.log'); + \Bootstrap::registerMonolog('TimerEventCron', $level, $message, $aContext, config("sys_sys"), 'processmaker.log'); } catch (\Exception $e) { throw $e; } @@ -1214,7 +1214,7 @@ class TimerEvent $ws = new \WsBase(); $case = new \Cases(); $common = new \ProcessMaker\Util\Common(); - $sysSys = (defined("SYS_SYS"))? SYS_SYS : "Undefined"; + $sysSys = (defined("SYS_SYS"))? config("sys_sys") : "Undefined"; $common->setFrontEnd($frontEnd); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Trigger.php b/workflow/engine/src/ProcessMaker/BusinessModel/Trigger.php index 8222defc9..d792c06d2 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Trigger.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Trigger.php @@ -171,7 +171,7 @@ class Trigger ) { //Check disabled code - $cs = new \CodeScanner(SYS_SYS); + $cs = new \CodeScanner(config("sys_sys")); $arrayFoundDisabledCode = $cs->checkDisabledCode("SOURCE", $dataTrigger["TRI_WEBBOT"]); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/User.php b/workflow/engine/src/ProcessMaker/BusinessModel/User.php index 8a9860917..c6b716b45 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/User.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/User.php @@ -719,7 +719,7 @@ class User $aUserProperty = $userProperty->loadOrCreateIfNotExists($userUid, array("USR_PASSWORD_HISTORY" => serialize(array(Bootstrap::hashPassword($arrayData["USR_PASSWORD"]))))); $memKey = "rbacSession" . session_id(); - $memcache = &PMmemcached::getSingleton(defined("SYS_SYS") ? SYS_SYS : ""); + $memcache = &PMmemcached::getSingleton(defined("SYS_SYS") ? config("sys_sys") : ""); if (($rbac->aUserInfo = $memcache->get($memKey)) == false) { $rbac->loadUserRolePermission("PROCESSMAKER", $userUidLogged); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php index df51d4540..207edb829 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php @@ -43,7 +43,7 @@ class WebEntry { $this->pathDataPublic = defined("PATH_DATA_PUBLIC") ? PATH_DATA_PUBLIC : \G::$pathDataPublic; $this->httpHost = isset($_SERVER["HTTP_HOST"]) ? $_SERVER["HTTP_HOST"] : \G::$httpHost; - $this->sysSys = defined("SYS_SYS") ? SYS_SYS : \G::$sysSys; + $this->sysSys = defined("SYS_SYS") ? config("sys_sys") : \G::$sysSys; $this->sysSkin = defined("SYS_SKIN") ? SYS_SKIN : \G::$sysSkin; try { foreach ($this->arrayFieldDefinition as $key => $value) { @@ -851,7 +851,7 @@ class WebEntry try { if ((!isset($record['WE_LINK_GENERATION']) || $record['WE_LINK_GENERATION']==='DEFAULT') && $record["WE_METHOD"] == "WS") { $http = (\G::is_https())? "https://" : "http://"; - $url = $http . $_SERVER["HTTP_HOST"] . "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/" . $record["PRO_UID"]; + $url = $http . $_SERVER["HTTP_HOST"] . "/sys" . config("sys_sys") . "/" . SYS_LANG . "/" . SYS_SKIN . "/" . $record["PRO_UID"]; $record["WE_DATA"] = $url . "/" . $record["WE_DATA"]; } diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEvent.php b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEvent.php index 62ef10aba..5db7a1dbc 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEvent.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEvent.php @@ -1350,13 +1350,13 @@ class WebEntryEvent strpos($domain, 'https://') === 0; $url = ($hasProtocol ? '' : $http) . $domain . - "/sys" . SYS_SYS . "/" . + "/sys" . config("sys_sys") . "/" . $weLinkLanguage . "/" . $weLinkSkin . "/" . $prj_uid; return $url . "/" . $weData; } else { - $url = $http . $_SERVER["HTTP_HOST"] . "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/" . $prj_uid; + $url = $http . $_SERVER["HTTP_HOST"] . "/sys" . config("sys_sys") . "/" . SYS_LANG . "/" . SYS_SKIN . "/" . $prj_uid; return $url . "/" . $weData; } diff --git a/workflow/engine/src/ProcessMaker/Core/System.php b/workflow/engine/src/ProcessMaker/Core/System.php index e5b0e9837..bb475b7a4 100644 --- a/workflow/engine/src/ProcessMaker/Core/System.php +++ b/workflow/engine/src/ProcessMaker/Core/System.php @@ -1060,7 +1060,7 @@ class System $workspace = explode("|", $res['SKIN_WORKSPACE']); $swWS = false; foreach ($workspace as $key => $value) { - if ($value == SYS_SYS) { + if ($value == config("sys_sys")) { $swWS = true; break; } diff --git a/workflow/engine/src/ProcessMaker/Exporter/Exporter.php b/workflow/engine/src/ProcessMaker/Exporter/Exporter.php index 22a5a6a46..bb8357150 100644 --- a/workflow/engine/src/ProcessMaker/Exporter/Exporter.php +++ b/workflow/engine/src/ProcessMaker/Exporter/Exporter.php @@ -92,7 +92,7 @@ abstract class Exporter $data = array(); $data["metadata"] = $this->getMetadata(); - $data["metadata"]["workspace"] = defined("SYS_SYS") ? SYS_SYS : "Unknown"; + $data["metadata"]["workspace"] = defined("SYS_SYS") ? config("sys_sys") : "Unknown"; $data["metadata"]["name"] = $this->getProjectName(); $data["metadata"]["uid"] = $this->getProjectUid(); diff --git a/workflow/engine/src/ProcessMaker/Importer/Importer.php b/workflow/engine/src/ProcessMaker/Importer/Importer.php index fecb7e164..d11527080 100644 --- a/workflow/engine/src/ProcessMaker/Importer/Importer.php +++ b/workflow/engine/src/ProcessMaker/Importer/Importer.php @@ -771,7 +771,7 @@ abstract class Importer $exporter = new \ProcessMaker\Exporter\XmlExporter($prj_uid); $getProjectName = $exporter->truncateName($exporter->getProjectName(), false); - $outputDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP; + $outputDir = PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP; $version = Common::getLastVersionSpecialCharacters($outputDir, $getProjectName, "pmx") + 1; $outputFilename = $outputDir . sprintf("%s-%s.%s", str_replace(" ", "_", $getProjectName), $version, "pmx"); diff --git a/workflow/engine/src/ProcessMaker/Plugins/PluginRegistry.php b/workflow/engine/src/ProcessMaker/Plugins/PluginRegistry.php index d521627fb..00e2cf6b2 100644 --- a/workflow/engine/src/ProcessMaker/Plugins/PluginRegistry.php +++ b/workflow/engine/src/ProcessMaker/Plugins/PluginRegistry.php @@ -45,8 +45,7 @@ class PluginRegistry use PluginStructure; use Attributes; use Init; - - const NAME_CACHE = SYS_SYS . __CLASS__; + /** * Instance of de object PluginRegistry * @var PluginRegistry $instance @@ -75,9 +74,9 @@ class PluginRegistry public static function loadSingleton() { if (self::$instance === null) { - if (is_null($object = Cache::get(self::NAME_CACHE))) { + if (is_null($object = Cache::get(config("sys_sys") . __CLASS__))) { $object = new PluginRegistry(); - Cache::put(self::NAME_CACHE, $object, config('app.cache_lifetime')); + Cache::put(config("sys_sys") . __CLASS__, $object, config('app.cache_lifetime')); } self::$instance = $object; } @@ -202,7 +201,7 @@ class PluginRegistry $fieldPlugin = PluginsRegistry::loadOrCreateIfNotExists(md5($plugin['PLUGIN_NAMESPACE']), $plugin); PluginsRegistry::update($fieldPlugin); } - Cache::pull(self::NAME_CACHE); + Cache::pull(config("sys_sys") . __CLASS__); } /** * Get the plugin details, by filename diff --git a/workflow/engine/src/ProcessMaker/Project/Bpmn.php b/workflow/engine/src/ProcessMaker/Project/Bpmn.php index 7807860cc..f856f9099 100644 --- a/workflow/engine/src/ProcessMaker/Project/Bpmn.php +++ b/workflow/engine/src/ProcessMaker/Project/Bpmn.php @@ -138,7 +138,7 @@ class Bpmn extends Handler //Define the variables for the logging $info = array( 'ip' => G::getIpAddress(), - 'workspace' => (defined("SYS_SYS"))? SYS_SYS : "Workspace undefined" + 'workspace' => (defined("SYS_SYS"))? config("sys_sys") : "Workspace undefined" ); $this->setContextLog($info); } diff --git a/workflow/engine/src/ProcessMaker/Project/Workflow.php b/workflow/engine/src/ProcessMaker/Project/Workflow.php index fce9a0965..cc05c9dd2 100644 --- a/workflow/engine/src/ProcessMaker/Project/Workflow.php +++ b/workflow/engine/src/ProcessMaker/Project/Workflow.php @@ -1123,10 +1123,10 @@ class Workflow extends Handler $basePath = PATH_DYNAFORM; break; case "PUBLIC": - $basePath = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP; + $basePath = PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP . "public" . PATH_SEP; break; case "TEMPLATES": - $basePath = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "mailTemplates" . PATH_SEP; + $basePath = PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP . "mailTemplates" . PATH_SEP; break; default: $basePath = ""; @@ -1213,7 +1213,7 @@ class Workflow extends Handler //Get templates and public files $workspaceTargetDirs = array("TEMPLATES" => "mailTemplates", "PUBLIC" => "public"); - $workspaceDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP; + $workspaceDir = PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP; foreach ($workspaceTargetDirs as $target => $workspaceTargetDir) { $templatesDir = $workspaceDir . $workspaceTargetDir . PATH_SEP . $processUid; diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Project.php b/workflow/engine/src/ProcessMaker/Services/Api/Project.php index 859e40511..855ae9ae0 100644 --- a/workflow/engine/src/ProcessMaker/Services/Api/Project.php +++ b/workflow/engine/src/ProcessMaker/Services/Api/Project.php @@ -189,7 +189,7 @@ class Project extends Api $objects = \G::json_decode($objects); $granularExporter = new GranularExporter($prj_uid); $outputFilename = $granularExporter->export($objects); - $outputFilename = PATH_DATA . 'sites' . PATH_SEP . SYS_SYS . PATH_SEP . 'files' . PATH_SEP . 'output' . + $outputFilename = PATH_DATA . 'sites' . PATH_SEP . config("sys_sys") . PATH_SEP . 'files' . PATH_SEP . 'output' . PATH_SEP . $outputFilename; $httpStream = new HttpStream(); $fileExtension = pathinfo($outputFilename, PATHINFO_EXTENSION); @@ -211,7 +211,7 @@ class Project extends Api $exporter = new \ProcessMaker\Exporter\XmlExporter($prj_uid); $getProjectName = $exporter->truncateName($exporter->getProjectName(), false); - $outputDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP; + $outputDir = PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP; $version = Common::getLastVersionSpecialCharacters($outputDir, $getProjectName, "pmx") + 1; $outputFilename = $outputDir . sprintf("%s-%s.%s", str_replace(" ", "_", $getProjectName), $version, "pmx"); diff --git a/workflow/engine/src/ProcessMaker/Services/OAuth2/Server.php b/workflow/engine/src/ProcessMaker/Services/OAuth2/Server.php index efc47648a..63ab1b572 100644 --- a/workflow/engine/src/ProcessMaker/Services/OAuth2/Server.php +++ b/workflow/engine/src/ProcessMaker/Services/OAuth2/Server.php @@ -144,8 +144,8 @@ class Server implements iAuthenticate $host = $_SERVER['SERVER_NAME'] . ($_SERVER['SERVER_PORT'] != '80' ? ':' . $_SERVER['SERVER_PORT'] : ''); $host = $http .'://'. $host; - $applicationsLink = sprintf('%s/%s/oauth2/apps', $host, SYS_SYS); - $authorizationLink = sprintf('%s/%s/oauth2/authorize?response_type=code&client_id=[the-client-id]&scope=*', $host, SYS_SYS); + $applicationsLink = sprintf('%s/%s/oauth2/apps', $host, config("sys_sys")); + $authorizationLink = sprintf('%s/%s/oauth2/authorize?response_type=code&client_id=[the-client-id]&scope=*', $host, config("sys_sys")); $view = new \Maveriks\Pattern\Mvc\SmartyView(PATH_CORE . "templates/oauth2/index.html"); $view->assign('host', $host); @@ -180,7 +180,7 @@ class Server implements iAuthenticate $host = $http . '://' . $_SERVER['SERVER_NAME'] . ($_SERVER['SERVER_PORT'] != '80' ? ':' . $_SERVER['SERVER_PORT'] : ''); $redirect = urlencode($host.'/'.self::$workspace.$_SERVER['REQUEST_URI']); - $loginLink = sprintf('%s/sys%s/%s/%s/login/login?u=%s', $host, SYS_SYS, SYS_LANG, SYS_SKIN, $redirect); + $loginLink = sprintf('%s/sys%s/%s/%s/login/login?u=%s', $host, config("sys_sys"), SYS_LANG, SYS_SKIN, $redirect); header('location: ' . $loginLink); die; } @@ -214,7 +214,7 @@ class Server implements iAuthenticate $view = new \Maveriks\Pattern\Mvc\SmartyView(PATH_CORE . "templates/oauth2/authorize.html"); $view->assign('user', $user); $view->assign('client', $client); - $view->assign('postUri', '/' . SYS_SYS . '/oauth2/authorize?' . $_SERVER['QUERY_STRING']); + $view->assign('postUri', '/' . config("sys_sys") . '/oauth2/authorize?' . $_SERVER['QUERY_STRING']); $view->render(); exit(); } @@ -364,7 +364,7 @@ class Server implements iAuthenticate $userTimeZone = $user->getUsrTimeZone(); if (trim($userTimeZone) == '') { - $arraySystemConfiguration = System::getSystemConfiguration('', '', SYS_SYS); + $arraySystemConfiguration = System::getSystemConfiguration('', '', config("sys_sys")); $userTimeZone = $arraySystemConfiguration['time_zone']; } diff --git a/workflow/engine/src/ProcessMaker/Util/FixReferencePath.php b/workflow/engine/src/ProcessMaker/Util/FixReferencePath.php index 94a2f8d3a..90afc53a2 100644 --- a/workflow/engine/src/ProcessMaker/Util/FixReferencePath.php +++ b/workflow/engine/src/ProcessMaker/Util/FixReferencePath.php @@ -200,7 +200,7 @@ class FixReferencePath */ public function regeneratePropelClasses($repTabName, $className, $fields, $guid) { - $sourcePath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP; + $sourcePath = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; @unlink($sourcePath . $className . '.php'); @unlink($sourcePath . $className . 'Peer.php'); diff --git a/workflow/engine/src/ProcessMaker/Util/System.php b/workflow/engine/src/ProcessMaker/Util/System.php index 2ce9e4dcc..c17efdaeb 100644 --- a/workflow/engine/src/ProcessMaker/Util/System.php +++ b/workflow/engine/src/ProcessMaker/Util/System.php @@ -27,7 +27,7 @@ class System public static function getTimeZone() { try { - $arraySystemConfiguration = PmSystem::getSystemConfiguration('', '', SYS_SYS); + $arraySystemConfiguration = PmSystem::getSystemConfiguration('', '', config("sys_sys")); //Return return $arraySystemConfiguration['time_zone']; diff --git a/workflow/engine/src/ProcessMaker/Util/helpers.php b/workflow/engine/src/ProcessMaker/Util/helpers.php index 828ef8e8d..02e82c322 100644 --- a/workflow/engine/src/ProcessMaker/Util/helpers.php +++ b/workflow/engine/src/ProcessMaker/Util/helpers.php @@ -251,8 +251,8 @@ function getVarsGrid($proUid, $dynUid) $dynaformFields = array(); - if (is_file(PATH_DATA . '/sites/' . SYS_SYS . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml') && filesize(PATH_DATA . '/sites/' . SYS_SYS . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml') > 0) { - $dyn = new dynaFormHandler(PATH_DATA . '/sites/' . SYS_SYS . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml'); + if (is_file(PATH_DATA . '/sites/' . config("sys_sys") . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml') && filesize(PATH_DATA . '/sites/' . config("sys_sys") . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml') > 0) { + $dyn = new dynaFormHandler(PATH_DATA . '/sites/' . config("sys_sys") . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml'); $dynaformFields[] = $dyn->getFields(); } diff --git a/workflow/engine/templates/setup/webServicesTree.php b/workflow/engine/templates/setup/webServicesTree.php index f9ae5e77b..b5cf43553 100644 --- a/workflow/engine/templates/setup/webServicesTree.php +++ b/workflow/engine/templates/setup/webServicesTree.php @@ -38,16 +38,16 @@ if (isset ( $_GET ['x'] )) { } } else { if (! isset ( $_SESSION ['END_POINT'] )) { - //$wsdl = 'http://'.$_SERVER['HTTP_HOST'].'/sys'.SYS_SYS.'/en/classic/services/wsdl'; + //$wsdl = 'http://'.$_SERVER['HTTP_HOST'].'/sys'.config("sys_sys").'/en/classic/services/wsdl'; $wsdl = 'http://' . $_SERVER ['HTTP_HOST']; - $workspace = SYS_SYS; + $workspace = config("sys_sys"); } else { $wsdl = $_SESSION ['END_POINT']; $workspace = $_SESSION ['WS_WORKSPACE']; } } -$defaultEndpoint = 'http://' . $_SERVER ['SERVER_NAME'] . ':' . $_SERVER ['SERVER_PORT'] . '/sys' . SYS_SYS . '/en/classic/services/wsdl2'; +$defaultEndpoint = 'http://' . $_SERVER ['SERVER_NAME'] . ':' . $_SERVER ['SERVER_PORT'] . '/sys' . config("sys_sys") . '/en/classic/services/wsdl2'; $wsdl = isset ( $_SESSION ['END_POINT'] ) ? $_SESSION ['END_POINT'] : $defaultEndpoint; diff --git a/workflow/public_html/bootstrap.php b/workflow/public_html/bootstrap.php index 9bc03c17d..ec894f64c 100644 --- a/workflow/public_html/bootstrap.php +++ b/workflow/public_html/bootstrap.php @@ -332,7 +332,7 @@ use ProcessMaker\Plugins\PluginRegistry; define ( 'SYS_SYS' , SYS_TEMP ); // defining constant for workspace shared directory - define ( 'PATH_WORKSPACE' , PATH_DB . SYS_SYS . PATH_SEP ); + define ( 'PATH_WORKSPACE' , PATH_DB . config("sys_sys") . PATH_SEP ); // including workspace shared classes -> particularlly for pmTables set_include_path(get_include_path() . PATH_SEPARATOR . PATH_WORKSPACE); } @@ -382,7 +382,7 @@ use ProcessMaker\Plugins\PluginRegistry; } // PM Paths DATA - define('PATH_DATA_SITE', PATH_DATA . 'sites/' . SYS_SYS . '/'); + define('PATH_DATA_SITE', PATH_DATA . 'sites/' . config("sys_sys") . '/'); define('PATH_DOCUMENT', PATH_DATA_SITE . 'files/'); define('PATH_DATA_MAILTEMPLATES', PATH_DATA_SITE . 'mailTemplates/'); define('PATH_DATA_PUBLIC', PATH_DATA_SITE . 'public/'); @@ -394,7 +394,7 @@ use ProcessMaker\Plugins\PluginRegistry; define('SERVER_PORT', $_SERVER ['SERVER_PORT']); // create memcached singleton - $memcache = & PMmemcached::getSingleton(SYS_SYS); + $memcache = & PMmemcached::getSingleton(config("sys_sys")); // verify configuration for rest service if ($isRestRequest) { @@ -439,7 +439,7 @@ use ProcessMaker\Plugins\PluginRegistry; // unified log file for all databases $logFile = PATH_DATA . 'log' . PATH_SEP . 'propel.log'; - $logger = Log::singleton('file', $logFile, 'wf ' . SYS_SYS, null, PEAR_LOG_INFO); + $logger = Log::singleton('file', $logFile, 'wf ' . config("sys_sys"), null, PEAR_LOG_INFO); Propel::setLogger($logger); // log file for workflow database $con = Propel::getConnection('workflow'); @@ -573,13 +573,13 @@ use ProcessMaker\Plugins\PluginRegistry; } //redirect to login, if user changed the workspace in the URL - if (! $avoidChangedWorkspaceValidation && isset($_SESSION['WORKSPACE']) && $_SESSION['WORKSPACE'] != SYS_SYS) { - $_SESSION['WORKSPACE'] = SYS_SYS; + if (! $avoidChangedWorkspaceValidation && isset($_SESSION['WORKSPACE']) && $_SESSION['WORKSPACE'] != config("sys_sys")) { + $_SESSION['WORKSPACE'] = config("sys_sys"); G::SendTemporalMessage ('ID_USER_HAVENT_RIGHTS_SYSTEM', "error"); // verify if the current skin is a 'ux' variant $urlPart = substr(SYS_SKIN, 0, 2) == 'ux' && SYS_SKIN != 'uxs' ? '/main/login' : '/login/login'; - header('Location: /sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . $urlPart); + header('Location: /sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . $urlPart); die; } diff --git a/workflow/public_html/sysGeneric.php b/workflow/public_html/sysGeneric.php index d61fbc598..5e01f1323 100644 --- a/workflow/public_html/sysGeneric.php +++ b/workflow/public_html/sysGeneric.php @@ -40,7 +40,7 @@ function transactionLog($transactionName){ //Custom parameters if(defined("SYS_SYS")){ - newrelic_add_custom_parameter ("workspace", SYS_SYS); + newrelic_add_custom_parameter ("workspace", config("sys_sys")); } if(defined("SYS_LANG")){ newrelic_add_custom_parameter ("lang", SYS_LANG); @@ -66,7 +66,7 @@ function transactionLog($transactionName){ //Show correct transaction name if(defined("SYS_SYS")){ - newrelic_set_appname ("PM-".SYS_SYS.";$baseName"); + newrelic_set_appname ("PM-".config("sys_sys").";$baseName"); } if(defined("PATH_CORE")){ $transactionName=str_replace(PATH_CORE,"",$transactionName); @@ -584,9 +584,10 @@ if (defined( 'SYS_TEMP' ) && SYS_TEMP != '') { if (file_exists( $pathFile )) { require_once ($pathFile); define( 'SYS_SYS', SYS_TEMP ); + config(["sys_sys" => SYS_TEMP]); // defining constant for workspace shared directory - define( 'PATH_WORKSPACE', PATH_DB . SYS_SYS . PATH_SEP ); + define( 'PATH_WORKSPACE', PATH_DB . config("sys_sys") . PATH_SEP ); // including workspace shared classes -> particularlly for pmTables set_include_path( get_include_path() . PATH_SEPARATOR . PATH_WORKSPACE ); } else { @@ -637,7 +638,7 @@ if (defined( 'SYS_TEMP' ) && SYS_TEMP != '') { } // PM Paths DATA -define( 'PATH_DATA_SITE', PATH_DATA . 'sites/' . SYS_SYS . '/' ); +define( 'PATH_DATA_SITE', PATH_DATA . 'sites/' . config("sys_sys") . '/' ); define( 'PATH_DOCUMENT', PATH_DATA_SITE . 'files/' ); define( 'PATH_DATA_MAILTEMPLATES', PATH_DATA_SITE . 'mailTemplates/' ); define( 'PATH_DATA_PUBLIC', PATH_DATA_SITE . 'public/' ); @@ -651,7 +652,7 @@ define( 'SERVER_PORT', $_SERVER['SERVER_PORT'] ); // create memcached singleton -$memcache = & PMmemcached::getSingleton( SYS_SYS ); +$memcache = & PMmemcached::getSingleton( config("sys_sys") ); // load Plugins base class @@ -670,7 +671,7 @@ if (defined( 'DEBUG_SQL_LOG' ) && DEBUG_SQL_LOG) { // unified log file for all databases $logFile = PATH_DATA . 'log' . PATH_SEP . 'propel.log'; - $logger = Log::singleton( 'file', $logFile, 'wf ' . SYS_SYS, null, PEAR_LOG_INFO ); + $logger = Log::singleton( 'file', $logFile, 'wf ' . config("sys_sys"), null, PEAR_LOG_INFO ); Propel::setLogger( $logger ); // log file for workflow database $con = Propel::getConnection( 'workflow' ); @@ -886,13 +887,13 @@ if (substr( SYS_COLLECTION, 0, 8 ) === 'gulliver') { } //redirect to login, if user changed the workspace in the URL -if (! $avoidChangedWorkspaceValidation && isset( $_SESSION['WORKSPACE'] ) && $_SESSION['WORKSPACE'] != SYS_SYS) { - $_SESSION['WORKSPACE'] = SYS_SYS; +if (! $avoidChangedWorkspaceValidation && isset( $_SESSION['WORKSPACE'] ) && $_SESSION['WORKSPACE'] != config("sys_sys")) { + $_SESSION['WORKSPACE'] = config("sys_sys"); Bootstrap::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', "error" ); // verify if the current skin is a 'ux' variant $urlPart = substr( SYS_SKIN, 0, 2 ) == 'ux' && SYS_SKIN != 'uxs' ? '/main/login' : '/login/login'; - header( 'Location: /sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . $urlPart ); + header( 'Location: /sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . $urlPart ); die(); } From 7c724070dd06091831d429d31069130591aeae25 Mon Sep 17 00:00:00 2001 From: Paula Quispe Date: Thu, 5 Oct 2017 14:54:41 -0400 Subject: [PATCH 30/85] HOR-3938 --- .../engine/classes/model/AppDelegation.php | 28 +- .../src/ProcessMaker/BusinessModel/Cases.php | 1593 +++++++++-------- .../src/ProcessMaker/Services/Api/Cases.php | 300 ++-- .../src/ProcessMaker/Services/Api/Light.php | 11 +- 4 files changed, 1062 insertions(+), 870 deletions(-) diff --git a/workflow/engine/classes/model/AppDelegation.php b/workflow/engine/classes/model/AppDelegation.php index 75beda41d..540479493 100644 --- a/workflow/engine/classes/model/AppDelegation.php +++ b/workflow/engine/classes/model/AppDelegation.php @@ -788,18 +788,26 @@ class AppDelegation extends BaseAppDelegation return $data['TAS_UID']; } + /** + * This function get the current user related to the specific case and index + * @param string $appUid, Uid related to the case + * @param integer $index, Index to review + * @return array + */ public function getCurrentUsers($appUid, $index) { - $oCriteria = new Criteria(); - $oCriteria->addSelectColumn( AppDelegationPeer::USR_UID ); - $oCriteria->add( AppDelegationPeer::APP_UID, $appUid ); - $oCriteria->add( AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN' ); - $oCriteria->add( AppDelegationPeer::DEL_INDEX, $index ); - $oRuleSet = AppDelegationPeer::doSelectRS( $oCriteria ); - $oRuleSet->setFetchmode( ResultSet::FETCHMODE_ASSOC ); - $oRuleSet->next(); - $data = $oRuleSet->getRow(); - return $data; + $criteria = new Criteria(); + $criteria->addSelectColumn( AppDelegationPeer::USR_UID ); + $criteria->add( AppDelegationPeer::APP_UID, $appUid ); + $criteria->add( AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN' ); + $criteria->add( AppDelegationPeer::DEL_INDEX, $index ); + $dataResult = AppDelegationPeer::doSelectRS( $criteria ); + $dataResult->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + if($dataResult->next()) { + return $dataResult->getRow(); + } else { + return []; + } } /** diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php b/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php index 938a61b01..3a37ab6f0 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php @@ -1,19 +1,54 @@ formatFieldNameInUppercase)? strtoupper($fieldName) : strtolower($fieldName); + return ($this->formatFieldNameInUppercase) ? strtoupper($fieldName) : strtolower($fieldName); } catch (Exception $e) { throw $e; } @@ -55,14 +90,14 @@ class Cases /** * Throw the exception "The Case doesn't exist" * - * @param string $applicationUid Unique id of Case + * @param string $applicationUid Unique id of Case * @param string $fieldNameForException Field name for the exception * * @return void */ private function throwExceptionCaseDoesNotExist($applicationUid, $fieldNameForException) { - throw new Exception(\G::LoadTranslation( + throw new Exception(G::LoadTranslation( 'ID_CASE_DOES_NOT_EXIST2', [$fieldNameForException, $applicationUid] )); } @@ -70,8 +105,8 @@ class Cases /** * Verify if does not exist the Case in table APPLICATION * - * @param string $applicationUid Unique id of Case - * @param string $delIndex Delegation index + * @param string $applicationUid Unique id of Case + * @param string $delIndex Delegation index * @param string $fieldNameForException Field name for the exception * * return void Throw exception if does not exist the Case in table APPLICATION @@ -79,12 +114,12 @@ class Cases public function throwExceptionIfNotExistsCase($applicationUid, $delIndex, $fieldNameForException) { try { - $obj = \ApplicationPeer::retrieveByPK($applicationUid); + $obj = ApplicationPeer::retrieveByPK($applicationUid); $flag = is_null($obj); if (!$flag && $delIndex > 0) { - $obj = \AppDelegationPeer::retrieveByPK($applicationUid, $delIndex); + $obj = AppDelegationPeer::retrieveByPK($applicationUid, $delIndex); $flag = is_null($obj); } @@ -100,9 +135,9 @@ class Cases /** * Get Application record * - * @param string $applicationUid Unique id of Case - * @param array $arrayVariableNameForException Variable name for exception - * @param bool $throwException Flag to throw the exception if the main parameters are invalid or do not exist + * @param string $applicationUid Unique id of Case + * @param array $arrayVariableNameForException Variable name for exception + * @param bool $throwException Flag to throw the exception if the main parameters are invalid or do not exist * (TRUE: throw the exception; FALSE: returns FALSE) * * @return array Returns an array with Application record, ThrowTheException/FALSE otherwise @@ -113,7 +148,7 @@ class Cases $throwException = true ) { try { - $obj = \ApplicationPeer::retrieveByPK($applicationUid); + $obj = ApplicationPeer::retrieveByPK($applicationUid); if (is_null($obj)) { if ($throwException) { @@ -126,7 +161,7 @@ class Cases } //Return - return $obj->toArray(\BasePeer::TYPE_FIELDNAME); + return $obj->toArray(BasePeer::TYPE_FIELDNAME); } catch (Exception $e) { throw $e; } @@ -135,10 +170,10 @@ class Cases /** * Get AppDelegation record * - * @param string $applicationUid Unique id of Case - * @param int $delIndex Delegation index - * @param array $arrayVariableNameForException Variable name for exception - * @param bool $throwException Flag to throw the exception if the main parameters are invalid or do not exist + * @param string $applicationUid Unique id of Case + * @param int $delIndex Delegation index + * @param array $arrayVariableNameForException Variable name for exception + * @param bool $throwException Flag to throw the exception if the main parameters are invalid or do not exist * (TRUE: throw the exception; FALSE: returns FALSE) * * @return array Returns an array with AppDelegation record, ThrowTheException/FALSE otherwise @@ -150,11 +185,11 @@ class Cases $throwException = true ) { try { - $obj = \AppDelegationPeer::retrieveByPK($applicationUid, $delIndex); + $obj = AppDelegationPeer::retrieveByPK($applicationUid, $delIndex); if (is_null($obj)) { if ($throwException) { - throw new Exception(\G::LoadTranslation( + throw new Exception(G::LoadTranslation( 'ID_CASE_DEL_INDEX_DOES_NOT_EXIST', [ $arrayVariableNameForException['$applicationUid'], @@ -169,7 +204,7 @@ class Cases } //Return - return $obj->toArray(\BasePeer::TYPE_FIELDNAME); + return $obj->toArray(BasePeer::TYPE_FIELDNAME); } catch (Exception $e) { throw $e; } @@ -178,8 +213,8 @@ class Cases /** * Get list counters * - * @param string $userUid Unique id of User - * @param array $arrayType Type lists + * @param string $userUid Unique id of User + * @param array $arrayType Type lists * * @return array Return the list counters */ @@ -190,7 +225,7 @@ class Cases $solrConf = System::solrEnv(); if ($solrConf !== false) { - $ApplicationSolrIndex = new \AppSolr( + $ApplicationSolrIndex = new AppSolr( $solrConf['solr_enabled'], $solrConf['solr_host'], $solrConf['solr_instance'] @@ -201,7 +236,7 @@ class Cases } } - $appCacheView = new \AppCacheView(); + $appCacheView = new AppCacheView(); if ($solrEnabled) { $arrayListCounter = array_merge( @@ -229,7 +264,7 @@ class Cases * /light/unassigned * * @access public - * @param array $dataList, Data for list + * @param array $dataList , Data for list * @return array $response */ public function getList($dataList = array()) @@ -241,48 +276,48 @@ class Cases //We need to use the USR_UID for the cases in the list $userUid = isset($dataList["userUid"]) ? $dataList["userUid"] : $dataList["userId"]; - $callback = isset( $dataList["callback"] ) ? $dataList["callback"] : "stcCallback1001"; - $dir = isset( $dataList["dir"] ) ? $dataList["dir"] : "DESC"; - $sort = isset( $dataList["sort"] ) ? $dataList["sort"] : "APPLICATION.APP_NUMBER"; + $callback = isset($dataList["callback"]) ? $dataList["callback"] : "stcCallback1001"; + $dir = isset($dataList["dir"]) ? $dataList["dir"] : "DESC"; + $sort = isset($dataList["sort"]) ? $dataList["sort"] : "APPLICATION.APP_NUMBER"; if ($sort === 'APP_CACHE_VIEW.APP_NUMBER') { $sort = "APPLICATION.APP_NUMBER"; } - $start = isset( $dataList["start"] ) ? $dataList["start"] : "0"; - $limit = isset( $dataList["limit"] ) ? $dataList["limit"] : ""; - $filter = isset( $dataList["filter"] ) ? $dataList["filter"] : ""; - $process = isset( $dataList["process"] ) ? $dataList["process"] : ""; - $category = isset( $dataList["category"] ) ? $dataList["category"] : ""; - $status = isset( $dataList["status"] ) ? strtoupper( $dataList["status"] ) : ""; - $search = isset( $dataList["search"] ) ? $dataList["search"] : ""; - $action = isset( $dataList["action"] ) ? $dataList["action"] : "todo"; - $paged = isset( $dataList["paged"] ) ? $dataList["paged"] : true; + $start = isset($dataList["start"]) ? $dataList["start"] : "0"; + $limit = isset($dataList["limit"]) ? $dataList["limit"] : ""; + $filter = isset($dataList["filter"]) ? $dataList["filter"] : ""; + $process = isset($dataList["process"]) ? $dataList["process"] : ""; + $category = isset($dataList["category"]) ? $dataList["category"] : ""; + $status = isset($dataList["status"]) ? strtoupper($dataList["status"]) : ""; + $search = isset($dataList["search"]) ? $dataList["search"] : ""; + $action = isset($dataList["action"]) ? $dataList["action"] : "todo"; + $paged = isset($dataList["paged"]) ? $dataList["paged"] : true; $type = "extjs"; - $dateFrom = (!empty( $dataList["dateFrom"] )) ? substr( $dataList["dateFrom"], 0, 10 ) : ""; - $dateTo = (!empty( $dataList["dateTo"] )) ? substr( $dataList["dateTo"], 0, 10 ) : ""; - $newerThan = (!empty($dataList['newerThan']))? $dataList['newerThan'] : ''; - $oldestThan = (!empty($dataList['oldestthan']))? $dataList['oldestthan'] : ''; + $dateFrom = (!empty($dataList["dateFrom"])) ? substr($dataList["dateFrom"], 0, 10) : ""; + $dateTo = (!empty($dataList["dateTo"])) ? substr($dataList["dateTo"], 0, 10) : ""; + $newerThan = (!empty($dataList['newerThan'])) ? $dataList['newerThan'] : ''; + $oldestThan = (!empty($dataList['oldestthan'])) ? $dataList['oldestthan'] : ''; $apps = new Applications(); $response = $apps->getAll( - $userUid, - $start, - $limit, - $action, - $filter, - $search, - $process, - $status, - $type, - $dateFrom, - $dateTo, - $callback, - $dir, - (strpos($sort, ".") !== false)? $sort : "APP_CACHE_VIEW." . $sort, - $category, - true, - $paged, - $newerThan, - $oldestThan + $userUid, + $start, + $limit, + $action, + $filter, + $search, + $process, + $status, + $type, + $dateFrom, + $dateTo, + $callback, + $dir, + (strpos($sort, ".") !== false) ? $sort : "APP_CACHE_VIEW." . $sort, + $category, + true, + $paged, + $newerThan, + $oldestThan ); if (!empty($response['data'])) { foreach ($response['data'] as &$value) { @@ -292,7 +327,7 @@ class Cases if ($paged) { $response['total'] = $response['totalCount']; - $response['start'] = $start+1; + $response['start'] = $start + 1; $response['limit'] = $limit; $response['sort'] = G::toLower($sort); $response['dir'] = G::toLower($dir); @@ -302,13 +337,15 @@ class Cases } else { $response = $response['data']; } + return $response; } + /** * Search cases and get list of cases * * @access public - * @param array $dataList, Data for list + * @param array $dataList , Data for list * @return array $response */ public function getCasesSearch($dataList = array()) @@ -320,21 +357,21 @@ class Cases //We need to user the USR_ID for performance $userId = $dataList["userId"]; - $dir = isset( $dataList["dir"] ) ? $dataList["dir"] : "DESC"; - $sort = isset( $dataList["sort"] ) ? $dataList["sort"] : "APPLICATION.APP_NUMBER"; + $dir = isset($dataList["dir"]) ? $dataList["dir"] : "DESC"; + $sort = isset($dataList["sort"]) ? $dataList["sort"] : "APPLICATION.APP_NUMBER"; if ($sort === 'APP_CACHE_VIEW.APP_NUMBER') { $sort = "APPLICATION.APP_NUMBER"; } - $start = isset( $dataList["start"] ) ? $dataList["start"] : "0"; - $limit = isset( $dataList["limit"] ) ? $dataList["limit"] : ""; - $process = isset( $dataList["process"] ) ? $dataList["process"] : ""; - $category = isset( $dataList["category"] ) ? $dataList["category"] : ""; - $status = isset( $dataList["status"] ) ? strtoupper( $dataList["status"] ) : ""; - $user = isset( $dataList["user"] ) ? $dataList["user"] : ""; - $search = isset( $dataList["search"] ) ? $dataList["search"] : ""; - $dateFrom = (!empty( $dataList["dateFrom"] )) ? substr( $dataList["dateFrom"], 0, 10 ) : ""; - $dateTo = (!empty( $dataList["dateTo"] )) ? substr( $dataList["dateTo"], 0, 10 ) : ""; - $filterStatus = isset( $dataList["filterStatus"] ) ? strtoupper( $dataList["filterStatus"] ) : ""; + $start = isset($dataList["start"]) ? $dataList["start"] : "0"; + $limit = isset($dataList["limit"]) ? $dataList["limit"] : ""; + $process = isset($dataList["process"]) ? $dataList["process"] : ""; + $category = isset($dataList["category"]) ? $dataList["category"] : ""; + $status = isset($dataList["status"]) ? strtoupper($dataList["status"]) : ""; + $user = isset($dataList["user"]) ? $dataList["user"] : ""; + $search = isset($dataList["search"]) ? $dataList["search"] : ""; + $dateFrom = (!empty($dataList["dateFrom"])) ? substr($dataList["dateFrom"], 0, 10) : ""; + $dateTo = (!empty($dataList["dateTo"])) ? substr($dataList["dateTo"], 0, 10) : ""; + $filterStatus = isset($dataList["filterStatus"]) ? strtoupper($dataList["filterStatus"]) : ""; $apps = new Applications(); $response = $apps->searchAll( @@ -352,7 +389,7 @@ class Cases ); $response['total'] = 0; - $response['start'] = $start+1; + $response['start'] = $start + 1; $response['limit'] = $limit; $response['sort'] = G::toLower($sort); $response['dir'] = G::toLower($dir); @@ -380,7 +417,7 @@ class Cases try { $solrEnabled = 0; if (($solrEnv = System::solrEnv()) !== false) { - $appSolr = new \AppSolr( + $appSolr = new AppSolr( $solrEnv["solr_enabled"], $solrEnv["solr_host"], $solrEnv["solr_instance"] @@ -398,29 +435,29 @@ class Cases $columsToInclude = array("APP_UID"); $solrSearchText = null; //Todo - $solrSearchText = $solrSearchText . (($solrSearchText != null)? " OR " : null) . "(APP_STATUS:TO_DO AND APP_ASSIGNED_USERS:" . $userUid . ")"; + $solrSearchText = $solrSearchText . (($solrSearchText != null) ? " OR " : null) . "(APP_STATUS:TO_DO AND APP_ASSIGNED_USERS:" . $userUid . ")"; $delegationIndexes[] = "APP_ASSIGNED_USER_DEL_INDEX_" . $userUid . "_txt"; //Draft - $solrSearchText = $solrSearchText . (($solrSearchText != null)? " OR " : null) . "(APP_STATUS:DRAFT AND APP_DRAFT_USER:" . $userUid . ")"; + $solrSearchText = $solrSearchText . (($solrSearchText != null) ? " OR " : null) . "(APP_STATUS:DRAFT AND APP_DRAFT_USER:" . $userUid . ")"; //Index is allways 1 $solrSearchText = "($solrSearchText)"; //Add del_index dynamic fields to list of resulting columns $columsToIncludeFinal = array_merge($columsToInclude, $delegationIndexes); - $solrRequestData = \EntitySolrRequestData::createForRequestPagination( + $solrRequestData = EntitySolrRequestData::createForRequestPagination( array( - "workspace" => $solrEnv["solr_instance"], + "workspace" => $solrEnv["solr_instance"], "startAfter" => 0, - "pageSize" => 1000, + "pageSize" => 1000, "searchText" => $solrSearchText, "numSortingCols" => 1, "sortCols" => array("APP_NUMBER"), - "sortDir" => array(strtolower("DESC")), - "includeCols" => $columsToIncludeFinal, + "sortDir" => array(strtolower("DESC")), + "includeCols" => $columsToIncludeFinal, "resultFormat" => "json" ) ); //Use search index to return list of cases - $searchIndex = new \BpmnEngineServicesSearchIndex($appSolr->isSolrEnabled(), $solrEnv["solr_host"]); + $searchIndex = new BpmnEngineServicesSearchIndex($appSolr->isSolrEnabled(), $solrEnv["solr_host"]); //Execute query $solrQueryResult = $searchIndex->getDataTablePaginatedList($solrRequestData); //Get the missing data from database @@ -484,7 +521,7 @@ class Cases $array['app_create_date'] = $array['createDate']; $array['app_update_date'] = $array['updateDate']; $array['current_task'] = $array['currentUsers']; - for ($i = 0; $i<=count($array['current_task'])-1; $i++) { + for ($i = 0; $i <= count($array['current_task']) - 1; $i++) { $current_task = $array['current_task'][$i]; $current_task['usr_uid'] = $current_task['userId']; $current_task['usr_name'] = trim($current_task['userName']); @@ -521,16 +558,19 @@ class Cases $oResponse = json_decode(json_encode($array), false); $oResponse->current_task = $current_task; } + //Return return $oResponse; } } - } catch (\InvalidIndexSearchTextException $e) { + } catch (InvalidIndexSearchTextException $e) { $arrayData = array(); - $arrayData[] = array ("app_uid" => $e->getMessage(), - "app_name" => $e->getMessage(), - "del_index" => $e->getMessage(), - "pro_uid" => $e->getMessage()); + $arrayData[] = array( + "app_uid" => $e->getMessage(), + "app_name" => $e->getMessage(), + "del_index" => $e->getMessage(), + "pro_uid" => $e->getMessage() + ); throw (new Exception($arrayData)); } } else { @@ -555,7 +595,7 @@ class Cases $aCurrent_task = array(); - for ($i = 0; $i<=count($array['current_task'])-1; $i++) { + for ($i = 0; $i <= count($array['current_task']) - 1; $i++) { $current_task = $array['current_task'][$i]; $current_task['usr_uid'] = $current_task['userId']; $current_task['usr_name'] = trim($current_task['userName']); @@ -594,6 +634,7 @@ class Cases $current_task = json_decode(json_encode($aCurrent_task), false); $oResponse = json_decode(json_encode($array), false); $oResponse->current_task = $current_task; + //Return return $oResponse; } @@ -616,48 +657,51 @@ class Cases //Verify data $this->throwExceptionIfNotExistsCase($applicationUid, 0, $this->getFieldNameByFormatFieldName("APP_UID")); - $criteria = new \Criteria("workflow"); + $criteria = new Criteria("workflow"); - $criteria->addSelectColumn(\ApplicationPeer::APP_UID); + $criteria->addSelectColumn(ApplicationPeer::APP_UID); - $criteria->add(\ApplicationPeer::APP_UID, $applicationUid, \Criteria::EQUAL); - $criteria->add(\ApplicationPeer::APP_STATUS, "COMPLETED", \Criteria::EQUAL); + $criteria->add(ApplicationPeer::APP_UID, $applicationUid, Criteria::EQUAL); + $criteria->add(ApplicationPeer::APP_STATUS, "COMPLETED", Criteria::EQUAL); - $rsCriteria = \ApplicationPeer::doSelectRS($criteria); + $rsCriteria = ApplicationPeer::doSelectRS($criteria); if ($rsCriteria->next()) { - throw new Exception(\G::LoadTranslation("ID_CASE_NO_CURRENT_TASKS_BECAUSE_CASE_ITS_COMPLETED", array($this->getFieldNameByFormatFieldName("APP_UID"), $applicationUid))); + throw new Exception(G::LoadTranslation("ID_CASE_NO_CURRENT_TASKS_BECAUSE_CASE_ITS_COMPLETED", + array($this->getFieldNameByFormatFieldName("APP_UID"), $applicationUid))); } //Get data $result = array(); - $oCriteria = new \Criteria( 'workflow' ); - $del = \DBAdapter::getStringDelimiter(); - $oCriteria->addSelectColumn(\AppDelegationPeer::DEL_INDEX); - $oCriteria->addSelectColumn(\AppDelegationPeer::TAS_UID); - $oCriteria->addSelectColumn(\AppDelegationPeer::DEL_INIT_DATE); - $oCriteria->addSelectColumn(\AppDelegationPeer::DEL_TASK_DUE_DATE); - $oCriteria->addSelectColumn(\TaskPeer::TAS_TITLE); - $oCriteria->addJoin(\AppDelegationPeer::TAS_UID, \TaskPeer::TAS_UID); - $oCriteria->add( \AppDelegationPeer::APP_UID, $applicationUid ); - $oCriteria->add( \AppDelegationPeer::USR_UID, $userUid ); - $oCriteria->add( \AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN' ); - $oCriteria->add( \AppDelegationPeer::DEL_FINISH_DATE, null, \Criteria::ISNULL ); - $oDataset = \AppDelegationPeer::doSelectRS( $oCriteria ); - $oDataset->setFetchmode( \ResultSet::FETCHMODE_ASSOC ); + $oCriteria = new Criteria('workflow'); + $del = DBAdapter::getStringDelimiter(); + $oCriteria->addSelectColumn(AppDelegationPeer::DEL_INDEX); + $oCriteria->addSelectColumn(AppDelegationPeer::TAS_UID); + $oCriteria->addSelectColumn(AppDelegationPeer::DEL_INIT_DATE); + $oCriteria->addSelectColumn(AppDelegationPeer::DEL_TASK_DUE_DATE); + $oCriteria->addSelectColumn(TaskPeer::TAS_TITLE); + $oCriteria->addJoin(AppDelegationPeer::TAS_UID, TaskPeer::TAS_UID); + $oCriteria->add(AppDelegationPeer::APP_UID, $applicationUid); + $oCriteria->add(AppDelegationPeer::USR_UID, $userUid); + $oCriteria->add(AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN'); + $oCriteria->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL); + $oDataset = AppDelegationPeer::doSelectRS($oCriteria); + $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); while ($aRow = $oDataset->getRow()) { - $result = array ('tas_uid' => $aRow['TAS_UID'], - 'tas_title' => $aRow['TAS_TITLE'], - 'del_index' => $aRow['DEL_INDEX'], - "del_init_date" => $aRow["DEL_INIT_DATE"] . "", - "del_task_due_date" => $aRow["DEL_TASK_DUE_DATE"]); + $result = array( + 'tas_uid' => $aRow['TAS_UID'], + 'tas_title' => $aRow['TAS_TITLE'], + 'del_index' => $aRow['DEL_INDEX'], + "del_init_date" => $aRow["DEL_INIT_DATE"] . "", + "del_task_due_date" => $aRow["DEL_TASK_DUE_DATE"] + ); $oDataset->next(); } //Return if (empty($result)) { - throw new Exception(\G::LoadTranslation("ID_CASES_INCORRECT_INFORMATION", array($applicationUid))); + throw new Exception(G::LoadTranslation("ID_CASES_INCORRECT_INFORMATION", array($applicationUid))); } else { return $result; } @@ -685,9 +729,9 @@ class Cases $variables = array_shift($variables); } Validator::proUid($processUid, '$pro_uid'); - $oTask = new \Task(); - if (! $oTask->taskExists($taskUid)) { - throw new Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('tas_uid'))); + $oTask = new ModelTask(); + if (!$oTask->taskExists($taskUid)) { + throw new Exception(G::LoadTranslation("ID_INVALID_VALUE_FOR", array('tas_uid'))); } $fields = $ws->newCase($processUid, $userUid, $taskUid, $variables); $array = json_decode(json_encode($fields), true); @@ -703,6 +747,7 @@ class Cases unset($array['caseNumber']); } $oResponse = json_decode(json_encode($array), false); + //Return return $oResponse; } catch (Exception $e) { @@ -731,17 +776,17 @@ class Cases $variables = array(array()); } Validator::proUid($processUid, '$pro_uid'); - $user = new \Users(); - if (! $user->userExists( $userUid )) { - throw new Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('usr_uid'))); + $user = new ModelUsers(); + if (!$user->userExists($userUid)) { + throw new Exception(G::LoadTranslation("ID_INVALID_VALUE_FOR", array('usr_uid'))); } $fields = $ws->newCaseImpersonate($processUid, $userUid, $variables, $taskUid); $array = json_decode(json_encode($fields), true); if ($array ["status_code"] != 0) { if ($array ["status_code"] == 12) { - throw (new Exception(\G::loadTranslation('ID_NO_STARTING_TASK') . '. tas_uid.')); + throw (new Exception(G::loadTranslation('ID_NO_STARTING_TASK') . '. tas_uid.')); } elseif ($array ["status_code"] == 13) { - throw (new Exception(\G::loadTranslation('ID_MULTIPLE_STARTING_TASKS') . '. tas_uid.')); + throw (new Exception(G::loadTranslation('ID_MULTIPLE_STARTING_TASKS') . '. tas_uid.')); } throw (new Exception($array ["message"])); } else { @@ -754,6 +799,7 @@ class Cases unset($array['caseNumber']); } $oResponse = json_decode(json_encode($array), false); + //Return return $oResponse; } catch (Exception $e) { @@ -791,7 +837,7 @@ class Cases unset($array['timestamp']); } } else { - throw new Exception(\G::LoadTranslation("ID_CASES_INCORRECT_INFORMATION", array($applicationUid))); + throw new Exception(G::LoadTranslation("ID_CASES_INCORRECT_INFORMATION", array($applicationUid))); } } catch (Exception $e) { throw $e; @@ -802,9 +848,9 @@ class Cases * Put cancel case * * @access public - * @param string $app_uid, Uid for case - * @param string $usr_uid, Uid for user - * @param string $del_index, Index for case + * @param string $app_uid , Uid for case + * @param string $usr_uid , Uid for user + * @param string $del_index , Index for case * @return array * * @author Brayan Pereyra (Cochalo) @@ -823,32 +869,32 @@ class Cases } Validator::isInteger($del_index, '$del_index'); - $case = new \Cases(); + $case = new ClassesCases(); $fields = $case->loadCase($app_uid); if ($fields['APP_STATUS'] == 'CANCELLED') { - throw (new Exception(\G::LoadTranslation("ID_CASE_ALREADY_CANCELED", array($app_uid)))); + throw (new Exception(G::LoadTranslation("ID_CASE_ALREADY_CANCELED", array($app_uid)))); } - $appCacheView = new \AppCacheView(); + $appCacheView = new AppCacheView(); $arrayProcess = $appCacheView->getProUidSupervisor($usr_uid); - $criteria = new \Criteria("workflow"); + $criteria = new Criteria("workflow"); - $criteria->addSelectColumn(\AppDelegationPeer::APP_UID); - $criteria->add(\AppDelegationPeer::APP_UID, $app_uid, \Criteria::EQUAL); - $criteria->add(\AppDelegationPeer::DEL_INDEX, $del_index, \Criteria::EQUAL); + $criteria->addSelectColumn(AppDelegationPeer::APP_UID); + $criteria->add(AppDelegationPeer::APP_UID, $app_uid, Criteria::EQUAL); + $criteria->add(AppDelegationPeer::DEL_INDEX, $del_index, Criteria::EQUAL); $criteria->add( - $criteria->getNewCriterion(\AppDelegationPeer::USR_UID, $usr_uid, \Criteria::EQUAL)->addOr( - $criteria->getNewCriterion(\AppDelegationPeer::PRO_UID, $arrayProcess, \Criteria::IN)) + $criteria->getNewCriterion(AppDelegationPeer::USR_UID, $usr_uid, Criteria::EQUAL)->addOr( + $criteria->getNewCriterion(AppDelegationPeer::PRO_UID, $arrayProcess, Criteria::IN)) ); - $rsCriteria = \AppDelegationPeer::doSelectRS($criteria); + $rsCriteria = AppDelegationPeer::doSelectRS($criteria); if (!$rsCriteria->next()) { - throw (new Exception(\G::LoadTranslation("ID_CASE_USER_INVALID_CANCEL_CASE", array($usr_uid)))); + throw (new Exception(G::LoadTranslation("ID_CASE_USER_INVALID_CANCEL_CASE", array($usr_uid)))); } - $case->cancelCase( $app_uid, $del_index, $usr_uid ); + $case->cancelCase($app_uid, $del_index, $usr_uid); } /** @@ -858,7 +904,7 @@ class Cases * @param string $app_uid , Uid for case * @param string $usr_uid , Uid for user * @param bool|string $del_index , Index for case - * @param null|string $unpaused_date, Date for unpaused + * @param null|string $unpaused_date , Date for unpaused * @return array * * @author Brayan Pereyra (Cochalo) @@ -878,45 +924,45 @@ class Cases Validator::isInteger($del_index, '$del_index'); - $case = new \Cases(); + $case = new ClassesCases(); $fields = $case->loadCase($app_uid); if ($fields['APP_STATUS'] == 'CANCELLED') { - throw (new Exception(\G::LoadTranslation("ID_CASE_IS_CANCELED", array($app_uid)))); + throw (new Exception(G::LoadTranslation("ID_CASE_IS_CANCELED", array($app_uid)))); } - $oDelay = new \AppDelay(); + $oDelay = new AppDelay(); if ($oDelay->isPaused($app_uid, $del_index)) { - throw (new Exception(\G::LoadTranslation("ID_CASE_PAUSED", array($app_uid)))); + throw (new Exception(G::LoadTranslation("ID_CASE_PAUSED", array($app_uid)))); } - $appCacheView = new \AppCacheView(); + $appCacheView = new AppCacheView(); $arrayProcess = $appCacheView->getProUidSupervisor($usr_uid); - $criteria = new \Criteria("workflow"); + $criteria = new Criteria("workflow"); - $criteria->addSelectColumn(\AppDelegationPeer::APP_UID); - $criteria->add(\AppDelegationPeer::APP_UID, $app_uid, \Criteria::EQUAL); - $criteria->add(\AppDelegationPeer::DEL_INDEX, $del_index, \Criteria::EQUAL); + $criteria->addSelectColumn(AppDelegationPeer::APP_UID); + $criteria->add(AppDelegationPeer::APP_UID, $app_uid, Criteria::EQUAL); + $criteria->add(AppDelegationPeer::DEL_INDEX, $del_index, Criteria::EQUAL); $criteria->add( - $criteria->getNewCriterion(\AppDelegationPeer::USR_UID, $usr_uid, \Criteria::EQUAL)->addOr( - $criteria->getNewCriterion(\AppDelegationPeer::PRO_UID, $arrayProcess, \Criteria::IN)) + $criteria->getNewCriterion(AppDelegationPeer::USR_UID, $usr_uid, Criteria::EQUAL)->addOr( + $criteria->getNewCriterion(AppDelegationPeer::PRO_UID, $arrayProcess, Criteria::IN)) ); - $criteria->add(\AppDelegationPeer::DEL_THREAD_STATUS, "OPEN", \Criteria::EQUAL); - $criteria->add(\AppDelegationPeer::DEL_FINISH_DATE, null, \Criteria::ISNULL); + $criteria->add(AppDelegationPeer::DEL_THREAD_STATUS, "OPEN", Criteria::EQUAL); + $criteria->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL); - $rsCriteria = \AppDelegationPeer::doSelectRS($criteria); + $rsCriteria = AppDelegationPeer::doSelectRS($criteria); if (!$rsCriteria->next()) { - throw (new Exception(\G::LoadTranslation("ID_CASE_USER_INVALID_PAUSED_CASE", array($usr_uid)))); + throw (new Exception(G::LoadTranslation("ID_CASE_USER_INVALID_PAUSED_CASE", array($usr_uid)))); } if ($unpaused_date != null) { Validator::isDate($unpaused_date, 'Y-m-d', '$unpaused_date'); } - $case->pauseCase( $app_uid, $del_index, $usr_uid, $unpaused_date ); + $case->pauseCase($app_uid, $del_index, $usr_uid, $unpaused_date); } /** @@ -943,43 +989,43 @@ class Cases } Validator::isInteger($del_index, '$del_index'); - $oDelay = new \AppDelay(); + $oDelay = new AppDelay(); if (!$oDelay->isPaused($app_uid, $del_index)) { - throw (new Exception(\G::LoadTranslation("ID_CASE_NOT_PAUSED", array($app_uid)))); + throw (new Exception(G::LoadTranslation("ID_CASE_NOT_PAUSED", array($app_uid)))); } - $appCacheView = new \AppCacheView(); + $appCacheView = new AppCacheView(); $arrayProcess = $appCacheView->getProUidSupervisor($usr_uid); - $criteria = new \Criteria("workflow"); - $criteria->addSelectColumn(\AppDelegationPeer::APP_UID); - $criteria->add(\AppDelegationPeer::APP_UID, $app_uid, \Criteria::EQUAL); - $criteria->add(\AppDelegationPeer::DEL_INDEX, $del_index, \Criteria::EQUAL); + $criteria = new Criteria("workflow"); + $criteria->addSelectColumn(AppDelegationPeer::APP_UID); + $criteria->add(AppDelegationPeer::APP_UID, $app_uid, Criteria::EQUAL); + $criteria->add(AppDelegationPeer::DEL_INDEX, $del_index, Criteria::EQUAL); $criteria->add( - $criteria->getNewCriterion(\AppDelegationPeer::USR_UID, $usr_uid, \Criteria::EQUAL)->addOr( - $criteria->getNewCriterion(\AppDelegationPeer::PRO_UID, $arrayProcess, \Criteria::IN)) + $criteria->getNewCriterion(AppDelegationPeer::USR_UID, $usr_uid, Criteria::EQUAL)->addOr( + $criteria->getNewCriterion(AppDelegationPeer::PRO_UID, $arrayProcess, Criteria::IN)) ); - $rsCriteria = \AppDelegationPeer::doSelectRS($criteria); + $rsCriteria = AppDelegationPeer::doSelectRS($criteria); if (!$rsCriteria->next()) { - throw (new Exception(\G::LoadTranslation("ID_CASE_USER_INVALID_UNPAUSE_CASE", array($usr_uid)))); + throw (new Exception(G::LoadTranslation("ID_CASE_USER_INVALID_UNPAUSE_CASE", array($usr_uid)))); } - $case = new \Cases(); - $case->unpauseCase( $app_uid, $del_index, $usr_uid ); + $case = new ClassesCases(); + $case->unpauseCase($app_uid, $del_index, $usr_uid); } /** * Put execute trigger case * * @access public - * @param string $appUid, Uid for case - * @param string $triUid, Uid for trigger - * @param string $userUid, Uid for user - * @param bool|string $delIndex, Index for case + * @param string $appUid , Uid for case + * @param string $triUid , Uid for trigger + * @param string $userUid , Uid for user + * @param bool|string $delIndex , Index for case * * @return array * @throws Exception @@ -1006,7 +1052,7 @@ class Cases global $RBAC; if (!method_exists($RBAC, 'initRBAC')) { - $RBAC = RBAC::getSingleton( PATH_DATA, session_id() ); + $RBAC = RBAC::getSingleton(PATH_DATA, session_id()); $RBAC->sSystem = 'PROCESSMAKER'; } @@ -1022,8 +1068,8 @@ class Cases * Delete case * * @access public - * @param string $app_uid, Uid for case - * @param string $usr_uid, Uid user + * @param string $app_uid , Uid for case + * @param string $usr_uid , Uid user * @return array * * @author Brayan Pereyra (Cochalo) @@ -1034,24 +1080,24 @@ class Cases Validator::isString($app_uid, '$app_uid'); Validator::appUid($app_uid, '$app_uid'); - $criteria = new \Criteria(); - $criteria->addSelectColumn( \ApplicationPeer::APP_STATUS ); - $criteria->addSelectColumn( \ApplicationPeer::APP_INIT_USER ); - $criteria->add( \ApplicationPeer::APP_UID, $app_uid, \Criteria::EQUAL ); - $dataset = \ApplicationPeer::doSelectRS($criteria); - $dataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $criteria = new Criteria(); + $criteria->addSelectColumn(ApplicationPeer::APP_STATUS); + $criteria->addSelectColumn(ApplicationPeer::APP_INIT_USER); + $criteria->add(ApplicationPeer::APP_UID, $app_uid, Criteria::EQUAL); + $dataset = ApplicationPeer::doSelectRS($criteria); + $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $dataset->next(); $aRow = $dataset->getRow(); if ($aRow['APP_STATUS'] != 'DRAFT') { - throw (new Exception(\G::LoadTranslation("ID_DELETE_CASE_NO_STATUS"))); + throw (new Exception(G::LoadTranslation("ID_DELETE_CASE_NO_STATUS"))); } if ($aRow['APP_INIT_USER'] != $usr_uid) { - throw (new Exception(\G::LoadTranslation("ID_DELETE_CASE_NO_OWNER"))); + throw (new Exception(G::LoadTranslation("ID_DELETE_CASE_NO_OWNER"))); } - $case = new \Cases(); - $case->removeCase( $app_uid ); + $case = new ClassesCases(); + $case->removeCase($app_uid); } /** @@ -1070,15 +1116,16 @@ class Cases if (!$delIndex) { $delIndex = AppDelegation::getCurrentIndex($applicationUid); //Check if the next task is a subprocess SYNCHRONOUS with a thread Open - $subAppData = new \SubApplication(); + $subAppData = new SubApplication(); $caseSubprocessPending = $subAppData->isSubProcessWithCasePending($applicationUid, $delIndex); if ($caseSubprocessPending) { - throw (new Exception(\G::LoadTranslation("ID_CASE_ALREADY_DERIVATED"))); + throw (new Exception(G::LoadTranslation("ID_CASE_ALREADY_DERIVATED"))); } } $ws = new WsBase(); - $fields = $ws->derivateCase($userUid, $applicationUid, $delIndex, $bExecuteTriggersBeforeAssignment = false); + $fields = $ws->derivateCase($userUid, $applicationUid, $delIndex, + $bExecuteTriggersBeforeAssignment = false); $array = json_decode(json_encode($fields), true); if ($array ["status_code"] != 0) { throw (new Exception($array ["message"])); @@ -1104,10 +1151,10 @@ class Cases public function getAllUploadedDocumentsCriteria($sProcessUID, $sApplicationUID, $sTasKUID, $sUserUID) { - $conf = new \Configurations(); + $conf = new Configurations(); $confEnvSetting = $conf->getFormats(); - $cases = new \cases(); + $cases = new ClassesCases(); $listing = false; $oPluginRegistry = PluginRegistry::loadSingleton(); @@ -1147,43 +1194,44 @@ class Cases } } $aDelete = $cases->getAllObjectsFrom($sProcessUID, $sApplicationUID, $sTasKUID, $sUserUID, 'DELETE'); - $oAppDocument = new \AppDocument(); - $oCriteria = new \Criteria('workflow'); - $oCriteria->add(\AppDocumentPeer::APP_UID, $sApplicationUID); - $oCriteria->add(\AppDocumentPeer::APP_DOC_TYPE, array('INPUT'), \Criteria::IN); - $oCriteria->add(\AppDocumentPeer::APP_DOC_STATUS, array('ACTIVE'), \Criteria::IN); + $oAppDocument = new AppDocument(); + $oCriteria = new Criteria('workflow'); + $oCriteria->add(AppDocumentPeer::APP_UID, $sApplicationUID); + $oCriteria->add(AppDocumentPeer::APP_DOC_TYPE, array('INPUT'), Criteria::IN); + $oCriteria->add(AppDocumentPeer::APP_DOC_STATUS, array('ACTIVE'), Criteria::IN); //$oCriteria->add(AppDocumentPeer::APP_DOC_UID, $aObjectPermissions['INPUT_DOCUMENTS'], Criteria::IN); $oCriteria->add( $oCriteria->getNewCriterion( - \AppDocumentPeer::APP_DOC_UID, $aObjectPermissions['INPUT_DOCUMENTS'], \Criteria::IN)-> - addOr($oCriteria->getNewCriterion(\AppDocumentPeer::USR_UID, array($sUserUID, '-1'), \Criteria::IN)) + AppDocumentPeer::APP_DOC_UID, $aObjectPermissions['INPUT_DOCUMENTS'], Criteria::IN)-> + addOr($oCriteria->getNewCriterion(AppDocumentPeer::USR_UID, array($sUserUID, '-1'), Criteria::IN)) ); $aConditions = array(); - $aConditions[] = array(\AppDocumentPeer::APP_UID, \AppDelegationPeer::APP_UID); - $aConditions[] = array(\AppDocumentPeer::DEL_INDEX, \AppDelegationPeer::DEL_INDEX); - $oCriteria->addJoinMC($aConditions, \Criteria::LEFT_JOIN); - $oCriteria->add(\AppDelegationPeer::PRO_UID, $sProcessUID); - $oCriteria->addAscendingOrderByColumn(\AppDocumentPeer::APP_DOC_INDEX); - $oDataset = \AppDocumentPeer::doSelectRS($oCriteria); - $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $aConditions[] = array(AppDocumentPeer::APP_UID, AppDelegationPeer::APP_UID); + $aConditions[] = array(AppDocumentPeer::DEL_INDEX, AppDelegationPeer::DEL_INDEX); + $oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN); + $oCriteria->add(AppDelegationPeer::PRO_UID, $sProcessUID); + $oCriteria->addAscendingOrderByColumn(AppDocumentPeer::APP_DOC_INDEX); + $oDataset = AppDocumentPeer::doSelectRS($oCriteria); + $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); $aInputDocuments = array(); $aInputDocuments[] = array( 'APP_DOC_UID' => 'char', 'DOC_UID' => 'char', 'APP_DOC_COMMENT' => 'char', - 'APP_DOC_FILENAME' => 'char', 'APP_DOC_INDEX' => 'integer' + 'APP_DOC_FILENAME' => 'char', + 'APP_DOC_INDEX' => 'integer' ); - $oUser = new \Users(); + $oUser = new ModelUsers(); while ($aRow = $oDataset->getRow()) { - $oCriteria2 = new \Criteria('workflow'); - $oCriteria2->add(\AppDelegationPeer::APP_UID, $sApplicationUID); - $oCriteria2->add(\AppDelegationPeer::DEL_INDEX, $aRow['DEL_INDEX']); - $oDataset2 = \AppDelegationPeer::doSelectRS($oCriteria2); - $oDataset2->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $oCriteria2 = new Criteria('workflow'); + $oCriteria2->add(AppDelegationPeer::APP_UID, $sApplicationUID); + $oCriteria2->add(AppDelegationPeer::DEL_INDEX, $aRow['DEL_INDEX']); + $oDataset2 = AppDelegationPeer::doSelectRS($oCriteria2); + $oDataset2->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset2->next(); $aRow2 = $oDataset2->getRow(); - $oTask = new \Task(); + $oTask = new ModelTask(); if ($oTask->taskExists($aRow2['TAS_UID'])) { $aTask = $oTask->load($aRow2['TAS_UID']); } else { @@ -1196,7 +1244,8 @@ class Cases try { $aAux1 = $oUser->load($aAux['USR_UID']); - $sUser = $conf->usersNameFormatBySetParameters($confEnvSetting["format"], $aAux1["USR_USERNAME"], $aAux1["USR_FIRSTNAME"], $aAux1["USR_LASTNAME"]); + $sUser = $conf->usersNameFormatBySetParameters($confEnvSetting["format"], $aAux1["USR_USERNAME"], + $aAux1["USR_FIRSTNAME"], $aAux1["USR_LASTNAME"]); } catch (Exception $oException) { $sUser = '***'; } @@ -1220,17 +1269,17 @@ class Cases $aFields['TITLE'] = $aFields['APP_DOC_COMMENT']; } //$aFields['POSITION'] = $_SESSION['STEP_POSITION']; - $aFields['CONFIRM'] = \G::LoadTranslation('ID_CONFIRM_DELETE_ELEMENT'); + $aFields['CONFIRM'] = G::LoadTranslation('ID_CONFIRM_DELETE_ELEMENT'); if (in_array($aRow['APP_DOC_UID'], $aDelete['INPUT_DOCUMENTS'])) { - $aFields['ID_DELETE'] = \G::LoadTranslation('ID_DELETE'); + $aFields['ID_DELETE'] = G::LoadTranslation('ID_DELETE'); } - $aFields['DOWNLOAD_LABEL'] = \G::LoadTranslation('ID_DOWNLOAD'); + $aFields['DOWNLOAD_LABEL'] = G::LoadTranslation('ID_DOWNLOAD'); $aFields['DOWNLOAD_LINK'] = "cases/cases_ShowDocument?a=" . $aRow['APP_DOC_UID'] . "&v=" . $aRow['DOC_VERSION']; $aFields['DOC_VERSION'] = $aRow['DOC_VERSION']; if (is_array($listing)) { foreach ($listing as $folderitem) { if ($folderitem->filename == $aRow['APP_DOC_UID']) { - $aFields['DOWNLOAD_LABEL'] = \G::LoadTranslation('ID_GET_EXTERNAL_FILE'); + $aFields['DOWNLOAD_LABEL'] = G::LoadTranslation('ID_GET_EXTERNAL_FILE'); $aFields['DOWNLOAD_LINK'] = $folderitem->downloadScript; continue; } @@ -1242,34 +1291,34 @@ class Cases } $oDataset->next(); } - $oAppDocument = new \AppDocument(); - $oCriteria = new \Criteria('workflow'); - $oCriteria->add(\AppDocumentPeer::APP_UID, $sApplicationUID); - $oCriteria->add(\AppDocumentPeer::APP_DOC_TYPE, array('ATTACHED'), \Criteria::IN); - $oCriteria->add(\AppDocumentPeer::APP_DOC_STATUS, array('ACTIVE'), \Criteria::IN); + $oAppDocument = new AppDocument(); + $oCriteria = new Criteria('workflow'); + $oCriteria->add(AppDocumentPeer::APP_UID, $sApplicationUID); + $oCriteria->add(AppDocumentPeer::APP_DOC_TYPE, array('ATTACHED'), Criteria::IN); + $oCriteria->add(AppDocumentPeer::APP_DOC_STATUS, array('ACTIVE'), Criteria::IN); $oCriteria->add( $oCriteria->getNewCriterion( - \AppDocumentPeer::APP_DOC_UID, $aObjectPermissions['INPUT_DOCUMENTS'], \Criteria::IN + AppDocumentPeer::APP_DOC_UID, $aObjectPermissions['INPUT_DOCUMENTS'], Criteria::IN )-> - addOr($oCriteria->getNewCriterion(\AppDocumentPeer::USR_UID, array($sUserUID, '-1'), \Criteria::IN))); + addOr($oCriteria->getNewCriterion(AppDocumentPeer::USR_UID, array($sUserUID, '-1'), Criteria::IN))); $aConditions = array(); - $aConditions[] = array(\AppDocumentPeer::APP_UID, \AppDelegationPeer::APP_UID); - $aConditions[] = array(\AppDocumentPeer::DEL_INDEX, \AppDelegationPeer::DEL_INDEX); - $oCriteria->addJoinMC($aConditions, \Criteria::LEFT_JOIN); - $oCriteria->add(\AppDelegationPeer::PRO_UID, $sProcessUID); - $oCriteria->addAscendingOrderByColumn(\AppDocumentPeer::APP_DOC_INDEX); - $oDataset = \AppDocumentPeer::doSelectRS($oCriteria); - $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $aConditions[] = array(AppDocumentPeer::APP_UID, AppDelegationPeer::APP_UID); + $aConditions[] = array(AppDocumentPeer::DEL_INDEX, AppDelegationPeer::DEL_INDEX); + $oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN); + $oCriteria->add(AppDelegationPeer::PRO_UID, $sProcessUID); + $oCriteria->addAscendingOrderByColumn(AppDocumentPeer::APP_DOC_INDEX); + $oDataset = AppDocumentPeer::doSelectRS($oCriteria); + $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); while ($aRow = $oDataset->getRow()) { - $oCriteria2 = new \Criteria('workflow'); - $oCriteria2->add(\AppDelegationPeer::APP_UID, $sApplicationUID); - $oCriteria2->add(\AppDelegationPeer::DEL_INDEX, $aRow['DEL_INDEX']); - $oDataset2 = \AppDelegationPeer::doSelectRS($oCriteria2); - $oDataset2->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $oCriteria2 = new Criteria('workflow'); + $oCriteria2->add(AppDelegationPeer::APP_UID, $sApplicationUID); + $oCriteria2->add(AppDelegationPeer::DEL_INDEX, $aRow['DEL_INDEX']); + $oDataset2 = AppDelegationPeer::doSelectRS($oCriteria2); + $oDataset2->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset2->next(); $aRow2 = $oDataset2->getRow(); - $oTask = new \Task(); + $oTask = new ModelTask(); if ($oTask->taskExists($aRow2['TAS_UID'])) { $aTask = $oTask->load($aRow2['TAS_UID']); } else { @@ -1280,7 +1329,8 @@ class Cases try { $aAux1 = $oUser->load($aAux['USR_UID']); - $sUser = $conf->usersNameFormatBySetParameters($confEnvSetting["format"], $aAux1["USR_USERNAME"], $aAux1["USR_FIRSTNAME"], $aAux1["USR_LASTNAME"]); + $sUser = $conf->usersNameFormatBySetParameters($confEnvSetting["format"], $aAux1["USR_USERNAME"], + $aAux1["USR_FIRSTNAME"], $aAux1["USR_LASTNAME"]); } catch (Exception $oException) { $sUser = '***'; } @@ -1315,26 +1365,27 @@ class Cases $oDataset->next(); } // Get input documents added/modified by a supervisor - Begin - $oAppDocument = new \AppDocument(); - $oCriteria = new \Criteria('workflow'); - $oCriteria->add(\AppDocumentPeer::APP_UID, $sApplicationUID); - $oCriteria->add(\AppDocumentPeer::APP_DOC_TYPE, array('INPUT'), \Criteria::IN); - $oCriteria->add(\AppDocumentPeer::APP_DOC_STATUS, array('ACTIVE'), \Criteria::IN); - $oCriteria->add(\AppDocumentPeer::DEL_INDEX, 100000); - $oCriteria->addJoin(\AppDocumentPeer::APP_UID, \ApplicationPeer::APP_UID, \Criteria::LEFT_JOIN); - $oCriteria->add(\ApplicationPeer::PRO_UID, $sProcessUID); - $oCriteria->addAscendingOrderByColumn(\AppDocumentPeer::APP_DOC_INDEX); - $oDataset = \AppDocumentPeer::doSelectRS($oCriteria); - $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $oAppDocument = new AppDocument(); + $oCriteria = new Criteria('workflow'); + $oCriteria->add(AppDocumentPeer::APP_UID, $sApplicationUID); + $oCriteria->add(AppDocumentPeer::APP_DOC_TYPE, array('INPUT'), Criteria::IN); + $oCriteria->add(AppDocumentPeer::APP_DOC_STATUS, array('ACTIVE'), Criteria::IN); + $oCriteria->add(AppDocumentPeer::DEL_INDEX, 100000); + $oCriteria->addJoin(AppDocumentPeer::APP_UID, ApplicationPeer::APP_UID, Criteria::LEFT_JOIN); + $oCriteria->add(ApplicationPeer::PRO_UID, $sProcessUID); + $oCriteria->addAscendingOrderByColumn(AppDocumentPeer::APP_DOC_INDEX); + $oDataset = AppDocumentPeer::doSelectRS($oCriteria); + $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); - $oUser = new \Users(); + $oUser = new ModelUsers(); while ($aRow = $oDataset->getRow()) { $aTask = array('TAS_TITLE' => '[ ' . G::LoadTranslation('ID_SUPERVISOR') . ' ]'); $aAux = $oAppDocument->load($aRow['APP_DOC_UID'], $aRow['DOC_VERSION']); $lastVersion = $oAppDocument->getLastAppDocVersion($aRow['APP_DOC_UID'], $sApplicationUID); try { $aAux1 = $oUser->load($aAux['USR_UID']); - $sUser = $conf->usersNameFormatBySetParameters($confEnvSetting["format"], $aAux1["USR_USERNAME"], $aAux1["USR_FIRSTNAME"], $aAux1["USR_LASTNAME"]); + $sUser = $conf->usersNameFormatBySetParameters($confEnvSetting["format"], $aAux1["USR_USERNAME"], + $aAux1["USR_FIRSTNAME"], $aAux1["USR_LASTNAME"]); } catch (Exception $oException) { $sUser = '***'; } @@ -1355,17 +1406,17 @@ class Cases $aFields['TITLE'] = $aFields['APP_DOC_COMMENT']; } //$aFields['POSITION'] = $_SESSION['STEP_POSITION']; - $aFields['CONFIRM'] = \G::LoadTranslation('ID_CONFIRM_DELETE_ELEMENT'); + $aFields['CONFIRM'] = G::LoadTranslation('ID_CONFIRM_DELETE_ELEMENT'); if (in_array($aRow['APP_DOC_UID'], $aDelete['INPUT_DOCUMENTS'])) { - $aFields['ID_DELETE'] = \G::LoadTranslation('ID_DELETE'); + $aFields['ID_DELETE'] = G::LoadTranslation('ID_DELETE'); } - $aFields['DOWNLOAD_LABEL'] = \G::LoadTranslation('ID_DOWNLOAD'); + $aFields['DOWNLOAD_LABEL'] = G::LoadTranslation('ID_DOWNLOAD'); $aFields['DOWNLOAD_LINK'] = "cases_ShowDocument?a=" . $aRow['APP_DOC_UID'] . "&v=" . $aRow['DOC_VERSION']; $aFields['DOC_VERSION'] = $aRow['DOC_VERSION']; if (is_array($listing)) { foreach ($listing as $folderitem) { if ($folderitem->filename == $aRow['APP_DOC_UID']) { - $aFields['DOWNLOAD_LABEL'] = \G::LoadTranslation('ID_GET_EXTERNAL_FILE'); + $aFields['DOWNLOAD_LABEL'] = G::LoadTranslation('ID_GET_EXTERNAL_FILE'); $aFields['DOWNLOAD_LINK'] = $folderitem->downloadScript; continue; } @@ -1382,9 +1433,10 @@ class Cases global $_DBArray; $_DBArray['inputDocuments'] = $aInputDocuments; - $oCriteria = new \Criteria('dbarray'); + $oCriteria = new Criteria('dbarray'); $oCriteria->setDBArrayTable('inputDocuments'); $oCriteria->addDescendingOrderByColumn('CREATE_DATE'); + return $oCriteria; } @@ -1401,10 +1453,10 @@ class Cases public function getAllGeneratedDocumentsCriteria($sProcessUID, $sApplicationUID, $sTasKUID, $sUserUID) { - $conf = new \Configurations(); + $conf = new Configurations(); $confEnvSetting = $conf->getFormats(); - $cases = new \cases(); + $cases = new ClassesCases(); $listing = false; $oPluginRegistry = PluginRegistry::loadSingleton(); @@ -1416,7 +1468,11 @@ class Cases } $aObjectPermissions = $cases->getAllObjects($sProcessUID, $sApplicationUID, $sTasKUID, $sUserUID); if (!is_array($aObjectPermissions)) { - $aObjectPermissions = array('DYNAFORMS' => array(-1),'INPUT_DOCUMENTS' => array(-1),'OUTPUT_DOCUMENTS' => array(-1)); + $aObjectPermissions = array( + 'DYNAFORMS' => array(-1), + 'INPUT_DOCUMENTS' => array(-1), + 'OUTPUT_DOCUMENTS' => array(-1) + ); } if (!isset($aObjectPermissions['DYNAFORMS'])) { $aObjectPermissions['DYNAFORMS'] = array(-1); @@ -1440,24 +1496,25 @@ class Cases } } $aDelete = $cases->getAllObjectsFrom($sProcessUID, $sApplicationUID, $sTasKUID, $sUserUID, 'DELETE'); - $oAppDocument = new \AppDocument(); - $oCriteria = new \Criteria('workflow'); - $oCriteria->add(\AppDocumentPeer::APP_UID, $sApplicationUID); - $oCriteria->add(\AppDocumentPeer::APP_DOC_TYPE, 'OUTPUT'); - $oCriteria->add(\AppDocumentPeer::APP_DOC_STATUS, array('ACTIVE'), \Criteria::IN); + $oAppDocument = new AppDocument(); + $oCriteria = new Criteria('workflow'); + $oCriteria->add(AppDocumentPeer::APP_UID, $sApplicationUID); + $oCriteria->add(AppDocumentPeer::APP_DOC_TYPE, 'OUTPUT'); + $oCriteria->add(AppDocumentPeer::APP_DOC_STATUS, array('ACTIVE'), Criteria::IN); //$oCriteria->add(AppDocumentPeer::APP_DOC_UID, $aObjectPermissions['OUTPUT_DOCUMENTS'], Criteria::IN); $oCriteria->add( $oCriteria->getNewCriterion( - \AppDocumentPeer::APP_DOC_UID, $aObjectPermissions['OUTPUT_DOCUMENTS'], \Criteria::IN)->addOr($oCriteria->getNewCriterion(\AppDocumentPeer::USR_UID, $sUserUID, \Criteria::EQUAL)) + AppDocumentPeer::APP_DOC_UID, $aObjectPermissions['OUTPUT_DOCUMENTS'], + Criteria::IN)->addOr($oCriteria->getNewCriterion(AppDocumentPeer::USR_UID, $sUserUID, Criteria::EQUAL)) ); $aConditions = array(); - $aConditions[] = array(\AppDocumentPeer::APP_UID, \AppDelegationPeer::APP_UID); - $aConditions[] = array(\AppDocumentPeer::DEL_INDEX, \AppDelegationPeer::DEL_INDEX); - $oCriteria->addJoinMC($aConditions, \Criteria::LEFT_JOIN); - $oCriteria->add(\AppDelegationPeer::PRO_UID, $sProcessUID); - $oCriteria->addAscendingOrderByColumn(\AppDocumentPeer::APP_DOC_INDEX); - $oDataset = \AppDocumentPeer::doSelectRS($oCriteria); - $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $aConditions[] = array(AppDocumentPeer::APP_UID, AppDelegationPeer::APP_UID); + $aConditions[] = array(AppDocumentPeer::DEL_INDEX, AppDelegationPeer::DEL_INDEX); + $oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN); + $oCriteria->add(AppDelegationPeer::PRO_UID, $sProcessUID); + $oCriteria->addAscendingOrderByColumn(AppDocumentPeer::APP_DOC_INDEX); + $oDataset = AppDocumentPeer::doSelectRS($oCriteria); + $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); $aOutputDocuments = array(); $aOutputDocuments[] = array( @@ -1467,16 +1524,16 @@ class Cases 'APP_DOC_FILENAME' => 'char', 'APP_DOC_INDEX' => 'integer' ); - $oUser = new \Users(); + $oUser = new ModelUsers(); while ($aRow = $oDataset->getRow()) { - $oCriteria2 = new \Criteria('workflow'); - $oCriteria2->add(\AppDelegationPeer::APP_UID, $sApplicationUID); - $oCriteria2->add(\AppDelegationPeer::DEL_INDEX, $aRow['DEL_INDEX']); - $oDataset2 = \AppDelegationPeer::doSelectRS($oCriteria2); - $oDataset2->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $oCriteria2 = new Criteria('workflow'); + $oCriteria2->add(AppDelegationPeer::APP_UID, $sApplicationUID); + $oCriteria2->add(AppDelegationPeer::DEL_INDEX, $aRow['DEL_INDEX']); + $oDataset2 = AppDelegationPeer::doSelectRS($oCriteria2); + $oDataset2->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset2->next(); $aRow2 = $oDataset2->getRow(); - $oTask = new \Task(); + $oTask = new ModelTask(); if ($oTask->taskExists($aRow2['TAS_UID'])) { $aTask = $oTask->load($aRow2['TAS_UID']); } else { @@ -1502,7 +1559,7 @@ class Cases if (is_array($listing)) { foreach ($listing as $folderitem) { if (($folderitem->filename == $aRow['APP_DOC_UID']) && ($folderitem->type == "PDF")) { - $filePdfLabel = \G::LoadTranslation('ID_GET_EXTERNAL_FILE') . " .pdf"; + $filePdfLabel = G::LoadTranslation('ID_GET_EXTERNAL_FILE') . " .pdf"; $filePdf = $folderitem->downloadScript; continue; } @@ -1518,7 +1575,7 @@ class Cases if (is_array($listing)) { foreach ($listing as $folderitem) { if (($folderitem->filename == $aRow['APP_DOC_UID']) && ($folderitem->type == "DOC")) { - $fileDocLabel = \G::LoadTranslation('ID_GET_EXTERNAL_FILE') . " .doc"; + $fileDocLabel = G::LoadTranslation('ID_GET_EXTERNAL_FILE') . " .doc"; $fileDoc = $folderitem->downloadScript; continue; } @@ -1545,7 +1602,7 @@ class Cases if (is_array($listing)) { foreach ($listing as $folderitem) { if (($folderitem->filename == $aRow['APP_DOC_UID']) && ($folderitem->type == "PDF")) { - $filePdfLabel = \G::LoadTranslation('ID_GET_EXTERNAL_FILE') . " .pdf"; + $filePdfLabel = G::LoadTranslation('ID_GET_EXTERNAL_FILE') . " .pdf"; $filePdf = $folderitem->downloadScript; continue; } @@ -1555,7 +1612,8 @@ class Cases } try { $aAux1 = $oUser->load($aAux['USR_UID']); - $sUser = $conf->usersNameFormatBySetParameters($confEnvSetting["format"], $aAux1["USR_USERNAME"], $aAux1["USR_FIRSTNAME"], $aAux1["USR_LASTNAME"]); + $sUser = $conf->usersNameFormatBySetParameters($confEnvSetting["format"], $aAux1["USR_USERNAME"], + $aAux1["USR_FIRSTNAME"], $aAux1["USR_LASTNAME"]); } catch (Exception $oException) { $sUser = '(USER DELETED)'; } @@ -1596,10 +1654,10 @@ class Cases $aFields['TITLE'] = $aFields['APP_DOC_COMMENT']; } //$aFields['POSITION'] = $_SESSION['STEP_POSITION']; - $aFields['CONFIRM'] = \G::LoadTranslation('ID_CONFIRM_DELETE_ELEMENT'); + $aFields['CONFIRM'] = G::LoadTranslation('ID_CONFIRM_DELETE_ELEMENT'); if (in_array($aRow['APP_DOC_UID'], $aObjectPermissions['OUTPUT_DOCUMENTS'])) { if (in_array($aRow['APP_DOC_UID'], $aDelete['OUTPUT_DOCUMENTS'])) { - $aFields['ID_DELETE'] = \G::LoadTranslation('ID_DELETE'); + $aFields['ID_DELETE'] = G::LoadTranslation('ID_DELETE'); } } $aOutputDocuments[] = $aFields; @@ -1609,9 +1667,10 @@ class Cases global $_DBArray; $_DBArray['outputDocuments'] = $aOutputDocuments; - $oCriteria = new \Criteria('dbarray'); + $oCriteria = new Criteria('dbarray'); $oCriteria->setDBArrayTable('outputDocuments'); $oCriteria->addDescendingOrderByColumn('CREATE_DATE'); + return $oCriteria; } @@ -1644,12 +1703,14 @@ class Cases } } } else { - $caseVariableAux = $this->__getFieldsAndValuesByDynaFormAndAppData($field, $appData, $caseVariable); + $caseVariableAux = $this->__getFieldsAndValuesByDynaFormAndAppData($field, $appData, + $caseVariable); $caseVariable = array_merge($caseVariable, $caseVariableAux); } } } } + return $caseVariable; } catch (Exception $e) { throw $e; @@ -1660,22 +1721,28 @@ class Cases * Get Case Variables * * @access public - * @param string $app_uid, Uid for case - * @param string $usr_uid, Uid for user - * @param string $dynaFormUid, Uid for dynaform + * @param string $app_uid , Uid for case + * @param string $usr_uid , Uid for user + * @param string $dynaFormUid , Uid for dynaform * @return array * * @author Brayan Pereyra (Cochalo) * @copyright Colosa - Bolivia */ - public function getCaseVariables($app_uid, $usr_uid, $dynaFormUid = null, $pro_uid = null, $act_uid = null, $app_index = null) - { + public function getCaseVariables( + $app_uid, + $usr_uid, + $dynaFormUid = null, + $pro_uid = null, + $act_uid = null, + $app_index = null + ) { Validator::isString($app_uid, '$app_uid'); Validator::appUid($app_uid, '$app_uid'); Validator::isString($usr_uid, '$usr_uid'); Validator::usrUid($usr_uid, '$usr_uid'); - $case = new \Cases(); + $case = new ClassesCases(); $fields = $case->loadCase($app_uid); $arrayCaseVariable = []; @@ -1686,15 +1753,15 @@ class Cases $data["CURRENT_DYNAFORM"] = $dynaFormUid; $pmDynaForm = new PmDynaform($data); $arrayDynaFormData = $pmDynaForm->getDynaform(); - $arrayDynContent = \G::json_decode($arrayDynaFormData['DYN_CONTENT']); + $arrayDynContent = G::json_decode($arrayDynaFormData['DYN_CONTENT']); $pmDynaForm->jsonr($arrayDynContent); - $arrayDynContent = \G::json_decode(\G::json_encode($arrayDynContent), true); + $arrayDynContent = G::json_decode(G::json_encode($arrayDynContent), true); $arrayAppData = $fields['APP_DATA']; $arrayCaseVariable = $this->__getFieldsAndValuesByDynaFormAndAppData( - $arrayDynContent['items'][0], $arrayAppData, $arrayCaseVariable + $arrayDynContent['items'][0], $arrayAppData, $arrayCaseVariable ); } else { $arrayCaseVariable = $fields['APP_DATA']; @@ -1702,20 +1769,20 @@ class Cases //Get historyDate for Dynaform if (!is_null($pro_uid) && !is_null($act_uid) && !is_null($app_index)) { - $oCriteriaAppHistory = new \Criteria("workflow"); - $oCriteriaAppHistory->addSelectColumn(\AppHistoryPeer::HISTORY_DATE); - $oCriteriaAppHistory->add(\AppHistoryPeer::APP_UID, $app_uid, \Criteria::EQUAL); - $oCriteriaAppHistory->add(\AppHistoryPeer::DEL_INDEX, $app_index, \Criteria::EQUAL); - $oCriteriaAppHistory->add(\AppHistoryPeer::PRO_UID, $pro_uid, \Criteria::EQUAL); - $oCriteriaAppHistory->add(\AppHistoryPeer::TAS_UID, $act_uid, \Criteria::EQUAL); - $oCriteriaAppHistory->add(\AppHistoryPeer::USR_UID, $usr_uid, \Criteria::EQUAL); + $oCriteriaAppHistory = new Criteria("workflow"); + $oCriteriaAppHistory->addSelectColumn(AppHistoryPeer::HISTORY_DATE); + $oCriteriaAppHistory->add(AppHistoryPeer::APP_UID, $app_uid, Criteria::EQUAL); + $oCriteriaAppHistory->add(AppHistoryPeer::DEL_INDEX, $app_index, Criteria::EQUAL); + $oCriteriaAppHistory->add(AppHistoryPeer::PRO_UID, $pro_uid, Criteria::EQUAL); + $oCriteriaAppHistory->add(AppHistoryPeer::TAS_UID, $act_uid, Criteria::EQUAL); + $oCriteriaAppHistory->add(AppHistoryPeer::USR_UID, $usr_uid, Criteria::EQUAL); if (!is_null($dynaFormUid)) { - $oCriteriaAppHistory->add(\AppHistoryPeer::DYN_UID, $dynaFormUid, \Criteria::EQUAL); + $oCriteriaAppHistory->add(AppHistoryPeer::DYN_UID, $dynaFormUid, Criteria::EQUAL); } $oCriteriaAppHistory->addDescendingOrderByColumn('HISTORY_DATE'); $oCriteriaAppHistory->setLimit(1); - $oDataset = \AppDocumentPeer::doSelectRS($oCriteriaAppHistory); - $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $oDataset = AppDocumentPeer::doSelectRS($oCriteriaAppHistory); + $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); if ($aRow = $oDataset->getRow()) { $dateHistory['SYS_VAR_UPDATE_DATE'] = $aRow['HISTORY_DATE']; @@ -1724,6 +1791,7 @@ class Cases } $arrayCaseVariable = array_merge($arrayCaseVariable, $dateHistory); } + return $arrayCaseVariable; } @@ -1731,16 +1799,16 @@ class Cases * Put Set Case Variables * * @access public - * @param string $app_uid, Uid for case - * @param array $app_data, Data for case variables - * @param string $dyn_uid, Uid for dynaform - * @param string $del_index, Index for case - * @param string $usr_uid, Uid for user + * @param string $app_uid , Uid for case + * @param array $app_data , Data for case variables + * @param string $dyn_uid , Uid for dynaform + * @param string $del_index , Index for case + * @param string $usr_uid , Uid for user * * @author Brayan Pereyra (Cochalo) * @copyright Colosa - Bolivia */ - public function setCaseVariables($app_uid, $app_data, $dyn_uid = null, $usr_uid ,$del_index = 0) + public function setCaseVariables($app_uid, $app_data, $dyn_uid = null, $usr_uid, $del_index = 0) { Validator::isString($app_uid, '$app_uid'); Validator::appUid($app_uid, '$app_uid'); @@ -1751,27 +1819,27 @@ class Cases $arrayResult = $this->getStatusInfo($app_uid); if ($arrayResult["APP_STATUS"] == "CANCELLED") { - throw new Exception(\G::LoadTranslation("ID_CASE_CANCELLED", array($app_uid))); + throw new Exception(G::LoadTranslation("ID_CASE_CANCELLED", array($app_uid))); } if ($arrayResult["APP_STATUS"] == "COMPLETED") { - throw new Exception(\G::LoadTranslation("ID_CASE_IS_COMPLETED", array($app_uid))); + throw new Exception(G::LoadTranslation("ID_CASE_IS_COMPLETED", array($app_uid))); } - $appCacheView = new \AppCacheView(); + $appCacheView = new AppCacheView(); $isProcessSupervisor = $appCacheView->getProUidSupervisor($usr_uid); - $criteria = new \Criteria("workflow"); - $criteria->addSelectColumn(\AppDelegationPeer::APP_UID); - $criteria->add(\AppDelegationPeer::APP_UID, $app_uid, \Criteria::EQUAL); - $criteria->add(\AppDelegationPeer::USR_UID, $usr_uid, \Criteria::EQUAL); + $criteria = new Criteria("workflow"); + $criteria->addSelectColumn(AppDelegationPeer::APP_UID); + $criteria->add(AppDelegationPeer::APP_UID, $app_uid, Criteria::EQUAL); + $criteria->add(AppDelegationPeer::USR_UID, $usr_uid, Criteria::EQUAL); $criteria->add( - $criteria->getNewCriterion(\AppDelegationPeer::USR_UID, $usr_uid, \Criteria::EQUAL)->addOr( - $criteria->getNewCriterion(\AppDelegationPeer::PRO_UID, $isProcessSupervisor, \Criteria::IN)) + $criteria->getNewCriterion(AppDelegationPeer::USR_UID, $usr_uid, Criteria::EQUAL)->addOr( + $criteria->getNewCriterion(AppDelegationPeer::PRO_UID, $isProcessSupervisor, Criteria::IN)) ); - $rsCriteria = \AppDelegationPeer::doSelectRS($criteria); + $rsCriteria = AppDelegationPeer::doSelectRS($criteria); if (!$rsCriteria->next()) { - throw (new Exception(\G::LoadTranslation("ID_NO_PERMISSION_NO_PARTICIPATED", array($usr_uid)))); + throw (new Exception(G::LoadTranslation("ID_NO_PERMISSION_NO_PARTICIPATED", array($usr_uid)))); } $_SESSION['APPLICATION'] = $app_uid; @@ -1787,7 +1855,7 @@ class Cases unset($app_data['__VARIABLE_DOCUMENT_DELETE__']); } - $case = new \Cases(); + $case = new ClassesCases(); $fields = $case->loadCase($app_uid, $del_index); $_POST['form'] = $app_data; @@ -1795,7 +1863,7 @@ class Cases $oDynaform = \DynaformPeer::retrieveByPK($dyn_uid); if ($oDynaform->getDynVersion() < 2) { - $oForm = new \Form ( $fields['PRO_UID'] . "/" . $dyn_uid, PATH_DYNAFORM ); + $oForm = new \Form ($fields['PRO_UID'] . "/" . $dyn_uid, PATH_DYNAFORM); $oForm->validatePost(); } } @@ -1824,7 +1892,7 @@ class Cases * Get Case Notes * * @access public - * @param string $app_uid, Uid for case + * @param string $app_uid , Uid for case * @return array * * @author Brayan Pereyra (Cochalo) @@ -1839,33 +1907,33 @@ class Cases Validator::isArray($data_get, '$data_get'); Validator::isArray($data_get, '$data_get'); - $start = isset( $data_get["start"] ) ? $data_get["start"] : "0"; - $limit = isset( $data_get["limit"] ) ? $data_get["limit"] : ""; - $sort = isset( $data_get["sort"] ) ? $data_get["sort"] : "APP_NOTES.NOTE_DATE"; - $dir = isset( $data_get["dir"] ) ? $data_get["dir"] : "DESC"; - $user = isset( $data_get["user"] ) ? $data_get["user"] : ""; - $dateFrom = (!empty( $data_get["dateFrom"] )) ? substr( $data_get["dateFrom"], 0, 10 ) : ""; - $dateTo = (!empty( $data_get["dateTo"] )) ? substr( $data_get["dateTo"], 0, 10 ) : ""; - $search = isset( $data_get["search"] ) ? $data_get["search"] : ""; - $paged = isset( $data_get["paged"] ) ? $data_get["paged"] : true; + $start = isset($data_get["start"]) ? $data_get["start"] : "0"; + $limit = isset($data_get["limit"]) ? $data_get["limit"] : ""; + $sort = isset($data_get["sort"]) ? $data_get["sort"] : "APP_NOTES.NOTE_DATE"; + $dir = isset($data_get["dir"]) ? $data_get["dir"] : "DESC"; + $user = isset($data_get["user"]) ? $data_get["user"] : ""; + $dateFrom = (!empty($data_get["dateFrom"])) ? substr($data_get["dateFrom"], 0, 10) : ""; + $dateTo = (!empty($data_get["dateTo"])) ? substr($data_get["dateTo"], 0, 10) : ""; + $search = isset($data_get["search"]) ? $data_get["search"] : ""; + $paged = isset($data_get["paged"]) ? $data_get["paged"] : true; - $case = new \Cases(); + $case = new ClassesCases(); $caseLoad = $case->loadCase($app_uid); - $pro_uid = $caseLoad['PRO_UID']; - $tas_uid = AppDelegation::getCurrentTask($app_uid); - $respView = $case->getAllObjectsFrom( $pro_uid, $app_uid, $tas_uid, $usr_uid, 'VIEW' ); - $respBlock = $case->getAllObjectsFrom( $pro_uid, $app_uid, $tas_uid, $usr_uid, 'BLOCK' ); + $pro_uid = $caseLoad['PRO_UID']; + $tas_uid = AppDelegation::getCurrentTask($app_uid); + $respView = $case->getAllObjectsFrom($pro_uid, $app_uid, $tas_uid, $usr_uid, 'VIEW'); + $respBlock = $case->getAllObjectsFrom($pro_uid, $app_uid, $tas_uid, $usr_uid, 'BLOCK'); if ($respView['CASES_NOTES'] == 0 && $respBlock['CASES_NOTES'] == 0) { - throw (new Exception(\G::LoadTranslation("ID_CASES_NOTES_NO_PERMISSIONS"))); + throw (new Exception(G::LoadTranslation("ID_CASES_NOTES_NO_PERMISSIONS"))); } if ($sort != 'APP_NOTE.NOTE_DATE') { $sort = G::toUpper($sort); - $columnsAppCacheView = \AppNotesPeer::getFieldNames(\BasePeer::TYPE_FIELDNAME); + $columnsAppCacheView = AppNotesPeer::getFieldNames(BasePeer::TYPE_FIELDNAME); if (!(in_array($sort, $columnsAppCacheView))) { $sort = 'APP_NOTES.NOTE_DATE'; } else { - $sort = 'APP_NOTES.'.$sort; + $sort = 'APP_NOTES.' . $sort; } } if ((int)$start == 1 || (int)$start == 0) { @@ -1917,6 +1985,7 @@ class Cases $con++; } } + return $response; } @@ -1924,8 +1993,8 @@ class Cases * Save new case note * * @access public - * @param string $app_uid, Uid for case - * @param array $app_data, Data for case variables + * @param string $app_uid , Uid for case + * @param array $app_data , Data for case variables * * @author Brayan Pereyra (Cochalo) * @copyright Colosa - Bolivia @@ -1940,19 +2009,19 @@ class Cases Validator::isString($note_content, '$note_content'); if (strlen($note_content) > 500) { - throw (new Exception(\G::LoadTranslation("ID_INVALID_MAX_PERMITTED", array($note_content,'500')))); + throw (new Exception(G::LoadTranslation("ID_INVALID_MAX_PERMITTED", array($note_content, '500')))); } Validator::isBoolean($send_mail, '$send_mail'); - $case = new \Cases(); + $case = new ClassesCases(); $caseLoad = $case->loadCase($app_uid); - $pro_uid = $caseLoad['PRO_UID']; - $tas_uid = AppDelegation::getCurrentTask($app_uid); - $respView = $case->getAllObjectsFrom( $pro_uid, $app_uid, $tas_uid, $usr_uid, 'VIEW' ); - $respBlock = $case->getAllObjectsFrom( $pro_uid, $app_uid, $tas_uid, $usr_uid, 'BLOCK' ); + $pro_uid = $caseLoad['PRO_UID']; + $tas_uid = AppDelegation::getCurrentTask($app_uid); + $respView = $case->getAllObjectsFrom($pro_uid, $app_uid, $tas_uid, $usr_uid, 'VIEW'); + $respBlock = $case->getAllObjectsFrom($pro_uid, $app_uid, $tas_uid, $usr_uid, 'BLOCK'); if ($respView['CASES_NOTES'] == 0 && $respBlock['CASES_NOTES'] == 0) { - throw (new Exception(\G::LoadTranslation("ID_CASES_NOTES_NO_PERMISSIONS"))); + throw (new Exception(G::LoadTranslation("ID_CASES_NOTES_NO_PERMISSIONS"))); } $note_content = addslashes($note_content); @@ -1971,17 +2040,17 @@ class Cases { try { return array( - $this->getFieldNameByFormatFieldName("TAS_UID") => $record["TAS_UID"], - $this->getFieldNameByFormatFieldName("TAS_TITLE") => $record["TAS_TITLE"] . "", + $this->getFieldNameByFormatFieldName("TAS_UID") => $record["TAS_UID"], + $this->getFieldNameByFormatFieldName("TAS_TITLE") => $record["TAS_TITLE"] . "", $this->getFieldNameByFormatFieldName("TAS_DESCRIPTION") => $record["TAS_DESCRIPTION"] . "", - $this->getFieldNameByFormatFieldName("TAS_START") => ($record["TAS_START"] == "TRUE")? 1 : 0, - $this->getFieldNameByFormatFieldName("TAS_TYPE") => $record["TAS_TYPE"], - $this->getFieldNameByFormatFieldName("TAS_DERIVATION") => $record["TAS_DERIVATION"], + $this->getFieldNameByFormatFieldName("TAS_START") => ($record["TAS_START"] == "TRUE") ? 1 : 0, + $this->getFieldNameByFormatFieldName("TAS_TYPE") => $record["TAS_TYPE"], + $this->getFieldNameByFormatFieldName("TAS_DERIVATION") => $record["TAS_DERIVATION"], $this->getFieldNameByFormatFieldName("TAS_ASSIGN_TYPE") => $record["TAS_ASSIGN_TYPE"], - $this->getFieldNameByFormatFieldName("USR_UID") => $record["USR_UID"] . "", - $this->getFieldNameByFormatFieldName("USR_USERNAME") => $record["USR_USERNAME"] . "", - $this->getFieldNameByFormatFieldName("USR_FIRSTNAME") => $record["USR_FIRSTNAME"] . "", - $this->getFieldNameByFormatFieldName("USR_LASTNAME") => $record["USR_LASTNAME"] . "" + $this->getFieldNameByFormatFieldName("USR_UID") => $record["USR_UID"] . "", + $this->getFieldNameByFormatFieldName("USR_USERNAME") => $record["USR_USERNAME"] . "", + $this->getFieldNameByFormatFieldName("USR_FIRSTNAME") => $record["USR_FIRSTNAME"] . "", + $this->getFieldNameByFormatFieldName("USR_LASTNAME") => $record["USR_LASTNAME"] . "" ); } catch (Exception $e) { throw $e; @@ -2008,7 +2077,7 @@ class Cases //Set variables $process = new \Process(); $application = new \Application(); - $conf = new \Configurations(); + $conf = new Configurations(); $arrayApplicationData = $application->Load($applicationUid); $processUid = $arrayApplicationData["PRO_UID"]; @@ -2019,28 +2088,28 @@ class Cases //Get data //SQL - $delimiter = \DBAdapter::getStringDelimiter(); + $delimiter = DBAdapter::getStringDelimiter(); - $criteria = new \Criteria("workflow"); + $criteria = new Criteria("workflow"); - $criteria->addSelectColumn(\TaskPeer::TAS_UID); - $criteria->addSelectColumn(\TaskPeer::TAS_TITLE); - $criteria->addSelectColumn(\TaskPeer::TAS_DESCRIPTION); - $criteria->addSelectColumn(\TaskPeer::TAS_START); - $criteria->addSelectColumn(\TaskPeer::TAS_TYPE); - $criteria->addSelectColumn(\TaskPeer::TAS_DERIVATION); - $criteria->addSelectColumn(\TaskPeer::TAS_ASSIGN_TYPE); - $criteria->addSelectColumn(\UsersPeer::USR_UID); - $criteria->addSelectColumn(\UsersPeer::USR_USERNAME); - $criteria->addSelectColumn(\UsersPeer::USR_FIRSTNAME); - $criteria->addSelectColumn(\UsersPeer::USR_LASTNAME); + $criteria->addSelectColumn(TaskPeer::TAS_UID); + $criteria->addSelectColumn(TaskPeer::TAS_TITLE); + $criteria->addSelectColumn(TaskPeer::TAS_DESCRIPTION); + $criteria->addSelectColumn(TaskPeer::TAS_START); + $criteria->addSelectColumn(TaskPeer::TAS_TYPE); + $criteria->addSelectColumn(TaskPeer::TAS_DERIVATION); + $criteria->addSelectColumn(TaskPeer::TAS_ASSIGN_TYPE); + $criteria->addSelectColumn(UsersPeer::USR_UID); + $criteria->addSelectColumn(UsersPeer::USR_USERNAME); + $criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME); + $criteria->addSelectColumn(UsersPeer::USR_LASTNAME); - $criteria->addJoin(\TaskPeer::TAS_LAST_ASSIGNED, \UsersPeer::USR_UID, \Criteria::LEFT_JOIN); + $criteria->addJoin(TaskPeer::TAS_LAST_ASSIGNED, UsersPeer::USR_UID, Criteria::LEFT_JOIN); - $criteria->add(\TaskPeer::PRO_UID, $processUid, \Criteria::EQUAL); + $criteria->add(TaskPeer::PRO_UID, $processUid, Criteria::EQUAL); - $rsCriteria = \TaskPeer::doSelectRS($criteria); - $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $rsCriteria = TaskPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); while ($rsCriteria->next()) { $row = $rsCriteria->getRow(); @@ -2049,23 +2118,23 @@ class Cases if ($row["TAS_TYPE"] == "NORMAL") { if (($row["TAS_TITLE"] . "" == "")) { //There is no Label in Current SYS_LANG language so try to find in English - by default - $task = new \Task(); + $task = new ModelTask(); $task->setTasUid($row["TAS_UID"]); $row["TAS_TITLE"] = $task->getTasTitle(); } } else { - $criteria2 = new \Criteria("workflow"); + $criteria2 = new Criteria("workflow"); - $criteria2->addSelectColumn(\SubProcessPeer::PRO_UID); - $criteria2->addSelectColumn(\TaskPeer::TAS_TITLE); - $criteria2->addSelectColumn(\TaskPeer::TAS_DESCRIPTION); - $criteria2->addJoin(\SubProcessPeer::TAS_PARENT, \TaskPeer::TAS_UID, \Criteria::LEFT_JOIN); - $criteria2->add(\SubProcessPeer::PRO_PARENT, $processUid); - $criteria2->add(\SubProcessPeer::TAS_PARENT, $row["TAS_UID"]); + $criteria2->addSelectColumn(SubProcessPeer::PRO_UID); + $criteria2->addSelectColumn(TaskPeer::TAS_TITLE); + $criteria2->addSelectColumn(TaskPeer::TAS_DESCRIPTION); + $criteria2->addJoin(SubProcessPeer::TAS_PARENT, TaskPeer::TAS_UID, Criteria::LEFT_JOIN); + $criteria2->add(SubProcessPeer::PRO_PARENT, $processUid); + $criteria2->add(SubProcessPeer::TAS_PARENT, $row["TAS_UID"]); - $rsCriteria2 = \SubProcessPeer::doSelectRS($criteria2); - $rsCriteria2->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $rsCriteria2 = SubProcessPeer::doSelectRS($criteria2); + $rsCriteria2->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rsCriteria2->next(); @@ -2081,18 +2150,18 @@ class Cases $routeType = ""; $arrayRoute = array(); - $criteria2 = new \Criteria("workflow"); + $criteria2 = new Criteria("workflow"); - $criteria2->addAsColumn("ROU_NUMBER", \RoutePeer::ROU_CASE); - $criteria2->addSelectColumn(\RoutePeer::ROU_TYPE); - $criteria2->addSelectColumn(\RoutePeer::ROU_CONDITION); - $criteria2->addAsColumn("TAS_UID", \RoutePeer::ROU_NEXT_TASK); - $criteria2->add(\RoutePeer::PRO_UID, $processUid, \Criteria::EQUAL); - $criteria2->add(\RoutePeer::TAS_UID, $row["TAS_UID"], \Criteria::EQUAL); + $criteria2->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); + $rsCriteria2 = RoutePeer::doSelectRS($criteria2); + $rsCriteria2->setFetchmode(ResultSet::FETCHMODE_ASSOC); while ($rsCriteria2->next()) { $row2 = $rsCriteria2->getRow(); @@ -2100,42 +2169,51 @@ class Cases $routeType = $row2["ROU_TYPE"]; $arrayRoute[] = array( - $this->getFieldNameByFormatFieldName("ROU_NUMBER") => (int)($row2["ROU_NUMBER"]), + $this->getFieldNameByFormatFieldName("ROU_NUMBER") => (int)($row2["ROU_NUMBER"]), $this->getFieldNameByFormatFieldName("ROU_CONDITION") => $row2["ROU_CONDITION"] . "", - $this->getFieldNameByFormatFieldName("TAS_UID") => $row2["TAS_UID"] + $this->getFieldNameByFormatFieldName("TAS_UID") => $row2["TAS_UID"] ); } //Delegations $arrayAppDelegation = array(); - $criteria2 = new \Criteria("workflow"); + $criteria2 = new Criteria("workflow"); - $criteria2->addSelectColumn(\AppDelegationPeer::DEL_INDEX); - $criteria2->addSelectColumn(\AppDelegationPeer::DEL_INIT_DATE); - $criteria2->addSelectColumn(\AppDelegationPeer::DEL_TASK_DUE_DATE); - $criteria2->addSelectColumn(\AppDelegationPeer::DEL_FINISH_DATE); - $criteria2->addSelectColumn(\UsersPeer::USR_UID); - $criteria2->addSelectColumn(\UsersPeer::USR_USERNAME); - $criteria2->addSelectColumn(\UsersPeer::USR_FIRSTNAME); - $criteria2->addSelectColumn(\UsersPeer::USR_LASTNAME); + $criteria2->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->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); + $criteria2->add(AppDelegationPeer::APP_UID, $applicationUid, Criteria::EQUAL); + $criteria2->add(AppDelegationPeer::TAS_UID, $row["TAS_UID"], Criteria::EQUAL); + $criteria2->addAscendingOrderByColumn(AppDelegationPeer::DEL_INDEX); - $rsCriteria2 = \AppDelegationPeer::doSelectRS($criteria2); - $rsCriteria2->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $rsCriteria2 = AppDelegationPeer::doSelectRS($criteria2); + $rsCriteria2->setFetchmode(ResultSet::FETCHMODE_ASSOC); while ($rsCriteria2->next()) { $row2 = $rsCriteria2->getRow(); $arrayAppDelegationDate = array( - "DEL_INIT_DATE" => array("date" => $row2["DEL_INIT_DATE"], "dateFormated" => \G::LoadTranslation("ID_CASE_NOT_YET_STARTED")), - "DEL_TASK_DUE_DATE" => array("date" => $row2["DEL_TASK_DUE_DATE"], "dateFormated" => \G::LoadTranslation("ID_CASE_NOT_YET_STARTED")), - "DEL_FINISH_DATE" => array("date" => $row2["DEL_FINISH_DATE"], "dateFormated" => \G::LoadTranslation("ID_NOT_FINISHED")) + "DEL_INIT_DATE" => array( + "date" => $row2["DEL_INIT_DATE"], + "dateFormated" => G::LoadTranslation("ID_CASE_NOT_YET_STARTED") + ), + "DEL_TASK_DUE_DATE" => array( + "date" => $row2["DEL_TASK_DUE_DATE"], + "dateFormated" => G::LoadTranslation("ID_CASE_NOT_YET_STARTED") + ), + "DEL_FINISH_DATE" => array( + "date" => $row2["DEL_FINISH_DATE"], + "dateFormated" => G::LoadTranslation("ID_NOT_FINISHED") + ) ); foreach ($arrayAppDelegationDate as $key => $value) { @@ -2147,7 +2225,7 @@ 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"])) { $t = strtotime($row2["DEL_FINISH_DATE"]) - strtotime($row2["DEL_INIT_DATE"]); @@ -2159,21 +2237,21 @@ class Cases $h = (int)($h); $m = (int)($m); - $appDelegationDuration = $h . " " . (($h == 1)? \G::LoadTranslation("ID_HOUR") : \G::LoadTranslation("ID_HOURS")); - $appDelegationDuration = $appDelegationDuration . " " . $m . " " . (($m == 1)? \G::LoadTranslation("ID_MINUTE") : \G::LoadTranslation("ID_MINUTES")); - $appDelegationDuration = $appDelegationDuration . " " . $s . " " . (($s == 1)? \G::LoadTranslation("ID_SECOND") : \G::LoadTranslation("ID_SECONDS")); + $appDelegationDuration = $h . " " . (($h == 1) ? G::LoadTranslation("ID_HOUR") : G::LoadTranslation("ID_HOURS")); + $appDelegationDuration = $appDelegationDuration . " " . $m . " " . (($m == 1) ? G::LoadTranslation("ID_MINUTE") : G::LoadTranslation("ID_MINUTES")); + $appDelegationDuration = $appDelegationDuration . " " . $s . " " . (($s == 1) ? G::LoadTranslation("ID_SECOND") : G::LoadTranslation("ID_SECONDS")); } $arrayAppDelegation[] = array( - $this->getFieldNameByFormatFieldName("DEL_INDEX") => (int)($row2["DEL_INDEX"]), - $this->getFieldNameByFormatFieldName("DEL_INIT_DATE") => $arrayAppDelegationDate["DEL_INIT_DATE"]["dateFormated"], + $this->getFieldNameByFormatFieldName("DEL_INDEX") => (int)($row2["DEL_INDEX"]), + $this->getFieldNameByFormatFieldName("DEL_INIT_DATE") => $arrayAppDelegationDate["DEL_INIT_DATE"]["dateFormated"], $this->getFieldNameByFormatFieldName("DEL_TASK_DUE_DATE") => $arrayAppDelegationDate["DEL_TASK_DUE_DATE"]["dateFormated"], - $this->getFieldNameByFormatFieldName("DEL_FINISH_DATE") => $arrayAppDelegationDate["DEL_FINISH_DATE"]["dateFormated"], - $this->getFieldNameByFormatFieldName("DEL_DURATION") => $appDelegationDuration, - $this->getFieldNameByFormatFieldName("USR_UID") => $row2["USR_UID"], - $this->getFieldNameByFormatFieldName("USR_USERNAME") => $row2["USR_USERNAME"] . "", - $this->getFieldNameByFormatFieldName("USR_FIRSTNAME") => $row2["USR_FIRSTNAME"] . "", - $this->getFieldNameByFormatFieldName("USR_LASTNAME") => $row2["USR_LASTNAME"] . "" + $this->getFieldNameByFormatFieldName("DEL_FINISH_DATE") => $arrayAppDelegationDate["DEL_FINISH_DATE"]["dateFormated"], + $this->getFieldNameByFormatFieldName("DEL_DURATION") => $appDelegationDuration, + $this->getFieldNameByFormatFieldName("USR_UID") => $row2["USR_UID"], + $this->getFieldNameByFormatFieldName("USR_USERNAME") => $row2["USR_USERNAME"] . "", + $this->getFieldNameByFormatFieldName("USR_FIRSTNAME") => $row2["USR_FIRSTNAME"] . "", + $this->getFieldNameByFormatFieldName("USR_LASTNAME") => $row2["USR_LASTNAME"] . "" ); } @@ -2181,30 +2259,30 @@ class Cases $status = ""; //$criteria2 - $criteria2 = new \Criteria("workflow"); + $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); + $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 = AppDelegationPeer::doSelectRS($criteria2); + $rsCriteria2->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rsCriteria2->next(); $row2 = $rsCriteria2->getRow(); //$criteria3 - $criteria3 = new \Criteria("workflow"); + $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); + $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 = AppDelegationPeer::doSelectRS($criteria3); + $rsCriteria3->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rsCriteria3->next(); @@ -2273,11 +2351,10 @@ class Cases Validator::appUid($app_uid, '$app_uid'); Validator::isInteger($del_index, '$del_index'); - $oCase = new \Cases(); + $oCase = new ClassesCases(); $aField = $oCase->loadCase($app_uid, $del_index); - $tas_uid = $aField["TAS_UID"]; + $tas_uid = $aField["TAS_UID"]; - $task = new \Tasks(); $aField["APP_DATA"] = $oCase->executeTriggers($tas_uid, $obj_type, $obj_uid, "AFTER", $aField["APP_DATA"]); $aField = $oCase->updateCase($app_uid, $aField); } @@ -2286,7 +2363,7 @@ class Cases * Get Steps evaluate * * @access public - * @param string $app_uid, Uid for case + * @param string $app_uid , Uid for case * @param int $del_index , Index for case * @return array * @@ -2298,10 +2375,10 @@ class Cases Validator::appUid($app_uid, '$app_uid'); Validator::isInteger($del_index, '$del_index'); - $oCase = new \Cases(); + $oCase = new ClassesCases(); $aCaseField = $oCase->loadCase($app_uid, $del_index); - $tas_uid = $aCaseField["TAS_UID"]; - $pro_uid = $aCaseField["PRO_UID"]; + $tas_uid = $aCaseField["TAS_UID"]; + $pro_uid = $aCaseField["PRO_UID"]; $oApplication = new Applications(); $aField = $oApplication->getSteps($app_uid, $del_index, $tas_uid, $pro_uid); @@ -2317,7 +2394,11 @@ class Cases if ($rsCriteria->next()) { $record = $rsCriteria->getRow(); - $arrayData = ['APP_STATUS' => $record['APP_STATUS'], 'DEL_INDEX' => [], 'PRO_UID' => $record['PRO_UID']]; + $arrayData = [ + 'APP_STATUS' => $record['APP_STATUS'], + 'DEL_INDEX' => [], + 'PRO_UID' => $record['PRO_UID'] + ]; $arrayData['DEL_INDEX'][] = $record['DEL_INDEX']; while ($rsCriteria->next()) { @@ -2338,8 +2419,8 @@ class Cases * Get status info Case * * @param string $applicationUid Unique id of Case - * @param int $delIndex Delegation index - * @param string $userUid Unique id of User + * @param int $delIndex Delegation index + * @param string $userUid Unique id of User * * @return array Return an array with status info Case, array empty otherwise */ @@ -2347,36 +2428,37 @@ class Cases { try { //Verify data - $this->throwExceptionIfNotExistsCase($applicationUid, $delIndex, $this->getFieldNameByFormatFieldName("APP_UID")); + $this->throwExceptionIfNotExistsCase($applicationUid, $delIndex, + $this->getFieldNameByFormatFieldName("APP_UID")); //Get data //Status is PAUSED - $delimiter = \DBAdapter::getStringDelimiter(); + $delimiter = DBAdapter::getStringDelimiter(); - $criteria = new \Criteria("workflow"); + $criteria = new Criteria("workflow"); $criteria->setDistinct(); $criteria->addSelectColumn($delimiter . 'PAUSED' . $delimiter . ' AS APP_STATUS'); - $criteria->addSelectColumn(\AppDelayPeer::APP_DEL_INDEX . " AS DEL_INDEX"); - $criteria->addSelectColumn(\AppDelayPeer::PRO_UID); + $criteria->addSelectColumn(AppDelayPeer::APP_DEL_INDEX . " AS DEL_INDEX"); + $criteria->addSelectColumn(AppDelayPeer::PRO_UID); - $criteria->add(\AppDelayPeer::APP_UID, $applicationUid, \Criteria::EQUAL); - $criteria->add(\AppDelayPeer::APP_TYPE, "PAUSE", \Criteria::EQUAL); + $criteria->add(AppDelayPeer::APP_UID, $applicationUid, Criteria::EQUAL); + $criteria->add(AppDelayPeer::APP_TYPE, "PAUSE", Criteria::EQUAL); $criteria->add( - $criteria->getNewCriterion(\AppDelayPeer::APP_DISABLE_ACTION_USER, null, \Criteria::ISNULL)->addOr( - $criteria->getNewCriterion(\AppDelayPeer::APP_DISABLE_ACTION_USER, 0, \Criteria::EQUAL)) + $criteria->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, null, Criteria::ISNULL)->addOr( + $criteria->getNewCriterion(AppDelayPeer::APP_DISABLE_ACTION_USER, 0, Criteria::EQUAL)) ); if ($delIndex != 0) { - $criteria->add(\AppDelayPeer::APP_DEL_INDEX, $delIndex, \Criteria::EQUAL); + $criteria->add(AppDelayPeer::APP_DEL_INDEX, $delIndex, Criteria::EQUAL); } if ($userUid != "") { - $criteria->add(\AppDelayPeer::APP_DELEGATION_USER, $userUid, \Criteria::EQUAL); + $criteria->add(AppDelayPeer::APP_DELEGATION_USER, $userUid, Criteria::EQUAL); } - $rsCriteria = \AppDelayPeer::doSelectRS($criteria); - $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $rsCriteria = AppDelayPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); $arrayData = $this->__getStatusInfoDataByRsCriteria($rsCriteria); @@ -2386,30 +2468,30 @@ class Cases //Status is UNASSIGNED if ($userUid != '') { - $appCacheView = new \AppCacheView(); + $appCacheView = new AppCacheView(); $criteria = $appCacheView->getUnassignedListCriteria($userUid); } else { - $criteria = new \Criteria('workflow'); + $criteria = new Criteria('workflow'); - $criteria->add(\AppCacheViewPeer::DEL_FINISH_DATE, null, \Criteria::ISNULL); - $criteria->add(\AppCacheViewPeer::USR_UID, '', \Criteria::EQUAL); + $criteria->add(AppCacheViewPeer::DEL_FINISH_DATE, null, Criteria::ISNULL); + $criteria->add(AppCacheViewPeer::USR_UID, '', Criteria::EQUAL); } $criteria->setDistinct(); $criteria->clearSelectColumns(); $criteria->addSelectColumn($delimiter . 'UNASSIGNED' . $delimiter . ' AS APP_STATUS'); - $criteria->addSelectColumn(\AppCacheViewPeer::DEL_INDEX); - $criteria->addSelectColumn(\AppCacheViewPeer::PRO_UID); + $criteria->addSelectColumn(AppCacheViewPeer::DEL_INDEX); + $criteria->addSelectColumn(AppCacheViewPeer::PRO_UID); - $criteria->add(\AppCacheViewPeer::APP_UID, $applicationUid, \Criteria::EQUAL); + $criteria->add(AppCacheViewPeer::APP_UID, $applicationUid, Criteria::EQUAL); if ($delIndex != 0) { - $criteria->add(\AppCacheViewPeer::DEL_INDEX, $delIndex, \Criteria::EQUAL); + $criteria->add(AppCacheViewPeer::DEL_INDEX, $delIndex, Criteria::EQUAL); } - $rsCriteria = \AppCacheViewPeer::doSelectRS($criteria); - $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $rsCriteria = AppCacheViewPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); $arrayData = $this->__getStatusInfoDataByRsCriteria($rsCriteria); @@ -2418,40 +2500,44 @@ class Cases } //Status is TO_DO, DRAFT - $criteria = new \Criteria("workflow"); + $criteria = new Criteria("workflow"); $criteria->setDistinct(); - $criteria->addSelectColumn(\ApplicationPeer::APP_STATUS); - $criteria->addSelectColumn(\ApplicationPeer::PRO_UID); - $criteria->addSelectColumn(\AppDelegationPeer::DEL_INDEX); + $criteria->addSelectColumn(ApplicationPeer::APP_STATUS); + $criteria->addSelectColumn(ApplicationPeer::PRO_UID); + $criteria->addSelectColumn(AppDelegationPeer::DEL_INDEX); $arrayCondition = array(); - $arrayCondition[] = array(\ApplicationPeer::APP_UID, \AppDelegationPeer::APP_UID, \Criteria::EQUAL); - $arrayCondition[] = array(\ApplicationPeer::APP_UID, \AppThreadPeer::APP_UID, \Criteria::EQUAL); - $arrayCondition[] = array(\ApplicationPeer::APP_UID, $delimiter . $applicationUid . $delimiter, \Criteria::EQUAL); - $criteria->addJoinMC($arrayCondition, \Criteria::LEFT_JOIN); + $arrayCondition[] = array(ApplicationPeer::APP_UID, AppDelegationPeer::APP_UID, Criteria::EQUAL); + $arrayCondition[] = array(ApplicationPeer::APP_UID, AppThreadPeer::APP_UID, Criteria::EQUAL); + $arrayCondition[] = array( + ApplicationPeer::APP_UID, + $delimiter . $applicationUid . $delimiter, + Criteria::EQUAL + ); + $criteria->addJoinMC($arrayCondition, Criteria::LEFT_JOIN); $criteria->add( - $criteria->getNewCriterion(\ApplicationPeer::APP_STATUS, "TO_DO", \Criteria::EQUAL)->addAnd( - $criteria->getNewCriterion(\AppDelegationPeer::DEL_FINISH_DATE, null, \Criteria::ISNULL))->addAnd( - $criteria->getNewCriterion(\AppDelegationPeer::DEL_THREAD_STATUS, "OPEN"))->addAnd( - $criteria->getNewCriterion(\AppThreadPeer::APP_THREAD_STATUS, "OPEN")) + $criteria->getNewCriterion(ApplicationPeer::APP_STATUS, "TO_DO", Criteria::EQUAL)->addAnd( + $criteria->getNewCriterion(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL))->addAnd( + $criteria->getNewCriterion(AppDelegationPeer::DEL_THREAD_STATUS, "OPEN"))->addAnd( + $criteria->getNewCriterion(AppThreadPeer::APP_THREAD_STATUS, "OPEN")) )->addOr( - $criteria->getNewCriterion(\ApplicationPeer::APP_STATUS, "DRAFT", \Criteria::EQUAL)->addAnd( - $criteria->getNewCriterion(\AppDelegationPeer::DEL_THREAD_STATUS, "OPEN"))->addAnd( - $criteria->getNewCriterion(\AppThreadPeer::APP_THREAD_STATUS, "OPEN")) + $criteria->getNewCriterion(ApplicationPeer::APP_STATUS, "DRAFT", Criteria::EQUAL)->addAnd( + $criteria->getNewCriterion(AppDelegationPeer::DEL_THREAD_STATUS, "OPEN"))->addAnd( + $criteria->getNewCriterion(AppThreadPeer::APP_THREAD_STATUS, "OPEN")) ); if ($delIndex != 0) { - $criteria->add(\AppDelegationPeer::DEL_INDEX, $delIndex, \Criteria::EQUAL); + $criteria->add(AppDelegationPeer::DEL_INDEX, $delIndex, Criteria::EQUAL); } if ($userUid != "") { - $criteria->add(\AppDelegationPeer::USR_UID, $userUid, \Criteria::EQUAL); + $criteria->add(AppDelegationPeer::USR_UID, $userUid, Criteria::EQUAL); } - $rsCriteria = \ApplicationPeer::doSelectRS($criteria); - $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $rsCriteria = ApplicationPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); $arrayData = $this->__getStatusInfoDataByRsCriteria($rsCriteria); @@ -2460,34 +2546,38 @@ class Cases } //Status is CANCELLED, COMPLETED - $criteria = new \Criteria("workflow"); + $criteria = new Criteria("workflow"); - $criteria->addSelectColumn(\ApplicationPeer::APP_STATUS); - $criteria->addSelectColumn(\ApplicationPeer::PRO_UID); - $criteria->addSelectColumn(\AppDelegationPeer::DEL_INDEX); + $criteria->addSelectColumn(ApplicationPeer::APP_STATUS); + $criteria->addSelectColumn(ApplicationPeer::PRO_UID); + $criteria->addSelectColumn(AppDelegationPeer::DEL_INDEX); $arrayCondition = array(); - $arrayCondition[] = array(\ApplicationPeer::APP_UID, \AppDelegationPeer::APP_UID, \Criteria::EQUAL); - $arrayCondition[] = array(\ApplicationPeer::APP_UID, $delimiter . $applicationUid . $delimiter, \Criteria::EQUAL); - $criteria->addJoinMC($arrayCondition, \Criteria::LEFT_JOIN); + $arrayCondition[] = array(ApplicationPeer::APP_UID, AppDelegationPeer::APP_UID, Criteria::EQUAL); + $arrayCondition[] = array( + ApplicationPeer::APP_UID, + $delimiter . $applicationUid . $delimiter, + Criteria::EQUAL + ); + $criteria->addJoinMC($arrayCondition, Criteria::LEFT_JOIN); if ($delIndex != 0) { - $criteria->add(\AppDelegationPeer::DEL_INDEX, $delIndex, \Criteria::EQUAL); + $criteria->add(AppDelegationPeer::DEL_INDEX, $delIndex, Criteria::EQUAL); } if ($userUid != "") { - $criteria->add(\AppDelegationPeer::USR_UID, $userUid, \Criteria::EQUAL); + $criteria->add(AppDelegationPeer::USR_UID, $userUid, Criteria::EQUAL); } $criteria2 = clone $criteria; $criteria2->setDistinct(); - $criteria2->add(\ApplicationPeer::APP_STATUS, ['CANCELLED', 'COMPLETED'], \Criteria::IN); - $criteria2->add(\AppDelegationPeer::DEL_LAST_INDEX, 1, \Criteria::EQUAL); + $criteria2->add(ApplicationPeer::APP_STATUS, ['CANCELLED', 'COMPLETED'], Criteria::IN); + $criteria2->add(AppDelegationPeer::DEL_LAST_INDEX, 1, Criteria::EQUAL); - $rsCriteria2 = \ApplicationPeer::doSelectRS($criteria2); - $rsCriteria2->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $rsCriteria2 = ApplicationPeer::doSelectRS($criteria2); + $rsCriteria2->setFetchmode(ResultSet::FETCHMODE_ASSOC); $arrayData = $this->__getStatusInfoDataByRsCriteria($rsCriteria2); @@ -2501,12 +2591,12 @@ class Cases $criteria2->setDistinct(); $criteria2->clearSelectColumns(); $criteria2->addSelectColumn($delimiter . 'PARTICIPATED' . $delimiter . ' AS APP_STATUS'); - $criteria2->addSelectColumn(\AppDelegationPeer::DEL_INDEX); - $criteria2->addSelectColumn(\ApplicationPeer::APP_UID); - $criteria2->addSelectColumn(\ApplicationPeer::PRO_UID); + $criteria2->addSelectColumn(AppDelegationPeer::DEL_INDEX); + $criteria2->addSelectColumn(ApplicationPeer::APP_UID); + $criteria2->addSelectColumn(ApplicationPeer::PRO_UID); - $rsCriteria2 = \ApplicationPeer::doSelectRS($criteria2); - $rsCriteria2->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $rsCriteria2 = ApplicationPeer::doSelectRS($criteria2); + $rsCriteria2->setFetchmode(ResultSet::FETCHMODE_ASSOC); $arrayData = $this->__getStatusInfoDataByRsCriteria($rsCriteria2); @@ -2534,7 +2624,7 @@ class Cases try { Validator::usrUid($usrUid, '$usr_uid'); - $case = new \Cases(); + $case = new ClassesCases(); $response = $case->getProcessListStartCase($usrUid, $typeView); return $response; @@ -2556,27 +2646,27 @@ class Cases try { Validator::usrUid($usrUid, '$usr_uid'); - $user = new \Users(); + $user = new ModelUsers(); $fields = $user->load($usrUid); $bookmark = empty($fields['USR_BOOKMARK_START_CASES']) ? array() : unserialize($fields['USR_BOOKMARK_START_CASES']); //Getting group id and adding the user id - $group = new \Groups(); + $group = new Groups(); $groups = $group->getActiveGroupsForAnUser($usrUid); $groups[] = $usrUid; - $c = new \Criteria(); + $c = new Criteria(); $c->clearSelectColumns(); - $c->addSelectColumn(\TaskPeer::TAS_UID); - $c->addSelectColumn(\TaskPeer::TAS_TITLE); - $c->addSelectColumn(\TaskPeer::PRO_UID); - $c->addSelectColumn(\ProcessPeer::PRO_TITLE); - $c->addJoin(\TaskPeer::PRO_UID, \ProcessPeer::PRO_UID, \Criteria::LEFT_JOIN); - $c->addJoin(\TaskPeer::TAS_UID, \TaskUserPeer::TAS_UID, \Criteria::LEFT_JOIN); - $c->add(\ProcessPeer::PRO_STATUS, 'ACTIVE'); - $c->add(\TaskPeer::TAS_START, 'TRUE'); - $c->add(\TaskUserPeer::USR_UID, $groups, \Criteria::IN); - $c->add(\TaskPeer::TAS_UID, $bookmark, \Criteria::IN); + $c->addSelectColumn(TaskPeer::TAS_UID); + $c->addSelectColumn(TaskPeer::TAS_TITLE); + $c->addSelectColumn(TaskPeer::PRO_UID); + $c->addSelectColumn(ProcessPeer::PRO_TITLE); + $c->addJoin(TaskPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN); + $c->addJoin(TaskPeer::TAS_UID, TaskUserPeer::TAS_UID, Criteria::LEFT_JOIN); + $c->add(ProcessPeer::PRO_STATUS, 'ACTIVE'); + $c->add(TaskPeer::TAS_START, 'TRUE'); + $c->add(TaskUserPeer::USR_UID, $groups, Criteria::IN); + $c->add(TaskPeer::TAS_UID, $bookmark, Criteria::IN); if ($typeView == 'category') { $c->addAsColumn('PRO_CATEGORY', 'PCS.PRO_CATEGORY'); @@ -2584,16 +2674,16 @@ class Cases $c->addAlias('PCS', 'PROCESS'); $c->addAlias('PCSCAT', 'PROCESS_CATEGORY'); $aConditions = array(); - $aConditions[] = array(\TaskPeer::PRO_UID, 'PCS.PRO_UID'); - $c->addJoinMC( $aConditions, \Criteria::LEFT_JOIN ); + $aConditions[] = array(TaskPeer::PRO_UID, 'PCS.PRO_UID'); + $c->addJoinMC($aConditions, Criteria::LEFT_JOIN); $aConditions = array(); $aConditions[] = array('PCS.PRO_CATEGORY', 'PCSCAT.CATEGORY_UID'); - $c->addJoinMC( $aConditions, \Criteria::LEFT_JOIN ); + $c->addJoinMC($aConditions, Criteria::LEFT_JOIN); } $c->setDistinct(); - $rs = \TaskPeer::doSelectRS($c); + $rs = TaskPeer::doSelectRS($c); - $rs->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); $processList = array(); while ($rs->next()) { $row = $rs->getRow(); @@ -2628,143 +2718,158 @@ class Cases /** * Get Users to reassign * - * @param string $userUid Unique id of User (User logged) - * @param string $taskUid Unique id of Task - * @param array $arrayFilterData Data of the filters - * @param string $sortField Field name to sort - * @param string $sortDir Direction of sorting (ASC, DESC) - * @param int $start Start - * @param int $limit Limit + * @param string $userUid Unique id of User (User logged) + * @param string $taskUid Unique id of Task + * @param array $arrayFilterData Data of the filters + * @param string $sortField Field name to sort + * @param string $sortDir Direction of sorting (ASC, DESC) + * @param int $start Start + * @param int $limit Limit * * @return array Return Users to reassign */ - public function getUsersToReassign($userUid, $taskUid, $arrayFilterData = null, $sortField = null, $sortDir = null, $start = null, $limit = null) - { + public function getUsersToReassign( + $userUid, + $taskUid, + $arrayFilterData = null, + $sortField = null, + $sortDir = null, + $start = null, + $limit = null + ) { try { $arrayUser = []; $numRecTotal = 0; //Set variables - $task = \TaskPeer::retrieveByPK($taskUid); + $task = TaskPeer::retrieveByPK($taskUid); $processUid = $task->getProUid(); - $user = new \ProcessMaker\BusinessModel\User(); - $task = new \Tasks(); - $group = new \Groups(); + $user = new BmUser(); + $task = new ClassesTasks(); + $group = new Groups(); //Set variables $filterName = 'filter'; if (!is_null($arrayFilterData) && is_array($arrayFilterData) && isset($arrayFilterData['filter'])) { $arrayAux = [ - '' => 'filter', - 'LEFT' => 'lfilter', + '' => 'filter', + 'LEFT' => 'lfilter', 'RIGHT' => 'rfilter' ]; - $filterName = $arrayAux[(isset($arrayFilterData['filterOption']))? $arrayFilterData['filterOption'] : '']; + $filterName = $arrayAux[(isset($arrayFilterData['filterOption'])) ? $arrayFilterData['filterOption'] : '']; } //Get data if (!is_null($limit) && $limit . '' == '0') { //Return return [ - 'total' => $numRecTotal, - 'start' => (int)((!is_null($start))? $start : 0), - 'limit' => (int)((!is_null($limit))? $limit : 0), - $filterName => (!is_null($arrayFilterData) && is_array($arrayFilterData) && isset($arrayFilterData['filter']))? $arrayFilterData['filter'] : '', - 'data' => $arrayUser + 'total' => $numRecTotal, + 'start' => (int)((!is_null($start)) ? $start : 0), + 'limit' => (int)((!is_null($limit)) ? $limit : 0), + $filterName => (!is_null($arrayFilterData) && is_array($arrayFilterData) && isset($arrayFilterData['filter'])) ? $arrayFilterData['filter'] : '', + 'data' => $arrayUser ]; } //Set variables - $processSupervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor(); + $processSupervisor = new BmProcessSupervisor(); - $arrayResult = $processSupervisor->getProcessSupervisors($processUid, 'ASSIGNED', null, null, null, 'group'); + $arrayResult = $processSupervisor->getProcessSupervisors($processUid, 'ASSIGNED', null, null, null, + 'group'); $arrayGroupUid = array_merge( - array_map(function ($value) { return $value['GRP_UID']; }, $task->getGroupsOfTask($taskUid, 1)), //Groups - array_map(function ($value) { return $value['GRP_UID']; }, $task->getGroupsOfTask($taskUid, 2)), //AdHoc Groups - array_map(function ($value) { return $value['grp_uid']; }, $arrayResult['data']) //ProcessSupervisor Groups + array_map(function ($value) { + return $value['GRP_UID']; + }, $task->getGroupsOfTask($taskUid, 1)), //Groups + array_map(function ($value) { + return $value['GRP_UID']; + }, $task->getGroupsOfTask($taskUid, 2)), //AdHoc Groups + array_map(function ($value) { + return $value['grp_uid']; + }, $arrayResult['data']) //ProcessSupervisor Groups ); $sqlTaskUser = ' - SELECT ' . \TaskUserPeer::USR_UID . ' - FROM ' . \TaskUserPeer::TABLE_NAME . ' - WHERE ' . \TaskUserPeer::TAS_UID . ' = \'%s\' AND - ' . \TaskUserPeer::TU_TYPE . ' IN (1, 2) AND - ' . \TaskUserPeer::TU_RELATION . ' = 1 + SELECT ' . TaskUserPeer::USR_UID . ' + FROM ' . TaskUserPeer::TABLE_NAME . ' + WHERE ' . TaskUserPeer::TAS_UID . ' = \'%s\' AND + ' . TaskUserPeer::TU_TYPE . ' IN (1, 2) AND + ' . TaskUserPeer::TU_RELATION . ' = 1 '; $sqlGroupUser = ' - SELECT ' . \GroupUserPeer::USR_UID . ' - FROM ' . \GroupUserPeer::TABLE_NAME . ' - WHERE ' . \GroupUserPeer::GRP_UID . ' IN (%s) + SELECT ' . GroupUserPeer::USR_UID . ' + FROM ' . GroupUserPeer::TABLE_NAME . ' + WHERE ' . GroupUserPeer::GRP_UID . ' IN (%s) '; $sqlProcessSupervisor = ' - SELECT ' . \ProcessUserPeer::USR_UID . ' - FROM ' . \ProcessUserPeer::TABLE_NAME . ' - WHERE ' . \ProcessUserPeer::PRO_UID . ' = \'%s\' AND - ' . \ProcessUserPeer::PU_TYPE . ' = \'%s\' + SELECT ' . ProcessUserPeer::USR_UID . ' + FROM ' . ProcessUserPeer::TABLE_NAME . ' + WHERE ' . ProcessUserPeer::PRO_UID . ' = \'%s\' AND + ' . ProcessUserPeer::PU_TYPE . ' = \'%s\' '; $sqlUserToReassign = '(' . sprintf($sqlTaskUser, $taskUid) . ')'; if (!empty($arrayGroupUid)) { - $sqlUserToReassign .= ' UNION (' . sprintf($sqlGroupUser, '\'' . implode('\', \'', $arrayGroupUid) . '\'') . ')'; + $sqlUserToReassign .= ' UNION (' . sprintf($sqlGroupUser, + '\'' . implode('\', \'', $arrayGroupUid) . '\'') . ')'; } $sqlUserToReassign .= ' UNION (' . sprintf($sqlProcessSupervisor, $processUid, 'SUPERVISOR') . ')'; //Query - $criteria = new \Criteria('workflow'); + $criteria = new Criteria('workflow'); - $criteria->addSelectColumn(\UsersPeer::USR_UID); - $criteria->addSelectColumn(\UsersPeer::USR_USERNAME); - $criteria->addSelectColumn(\UsersPeer::USR_FIRSTNAME); - $criteria->addSelectColumn(\UsersPeer::USR_LASTNAME); + $criteria->addSelectColumn(UsersPeer::USR_UID); + $criteria->addSelectColumn(UsersPeer::USR_USERNAME); + $criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME); + $criteria->addSelectColumn(UsersPeer::USR_LASTNAME); $criteria->addAlias('USER_TO_REASSIGN', '(' . $sqlUserToReassign . ')'); - $criteria->addJoin(\UsersPeer::USR_UID, 'USER_TO_REASSIGN.USR_UID', \Criteria::INNER_JOIN); + $criteria->addJoin(UsersPeer::USR_UID, 'USER_TO_REASSIGN.USR_UID', Criteria::INNER_JOIN); if (!is_null($arrayFilterData) && is_array($arrayFilterData) && isset($arrayFilterData['filter']) && trim($arrayFilterData['filter']) != '') { $arraySearch = [ - '' => '%' . $arrayFilterData['filter'] . '%', - 'LEFT' => $arrayFilterData['filter'] . '%', + '' => '%' . $arrayFilterData['filter'] . '%', + 'LEFT' => $arrayFilterData['filter'] . '%', 'RIGHT' => '%' . $arrayFilterData['filter'] ]; - $search = $arraySearch[(isset($arrayFilterData['filterOption']))? $arrayFilterData['filterOption'] : '']; + $search = $arraySearch[(isset($arrayFilterData['filterOption'])) ? $arrayFilterData['filterOption'] : '']; $criteria->add( - $criteria->getNewCriterion(\UsersPeer::USR_USERNAME, $search, \Criteria::LIKE)->addOr( - $criteria->getNewCriterion(\UsersPeer::USR_FIRSTNAME, $search, \Criteria::LIKE))->addOr( - $criteria->getNewCriterion(\UsersPeer::USR_LASTNAME, $search, \Criteria::LIKE)) + $criteria->getNewCriterion(UsersPeer::USR_USERNAME, $search, Criteria::LIKE)->addOr( + $criteria->getNewCriterion(UsersPeer::USR_FIRSTNAME, $search, Criteria::LIKE))->addOr( + $criteria->getNewCriterion(UsersPeer::USR_LASTNAME, $search, Criteria::LIKE)) ); } - $criteria->add(\UsersPeer::USR_STATUS, 'ACTIVE', \Criteria::EQUAL); + $criteria->add(UsersPeer::USR_STATUS, 'ACTIVE', Criteria::EQUAL); if (!$user->checkPermission($userUid, 'PM_SUPERVISOR')) { - $criteria->add(\UsersPeer::USR_UID, $userUid, \Criteria::NOT_EQUAL); + $criteria->add(UsersPeer::USR_UID, $userUid, Criteria::NOT_EQUAL); } //Number records total - $numRecTotal = \UsersPeer::doCount($criteria); + $numRecTotal = UsersPeer::doCount($criteria); //Query - $conf = new \Configurations(); - $sortFieldDefault = \UsersPeer::TABLE_NAME . '.' . $conf->userNameFormatGetFirstFieldByUsersTable(); + $conf = new Configurations(); + $sortFieldDefault = UsersPeer::TABLE_NAME . '.' . $conf->userNameFormatGetFirstFieldByUsersTable(); if (!is_null($sortField) && trim($sortField) != '') { $sortField = strtoupper($sortField); - if (in_array(\UsersPeer::TABLE_NAME . '.' . $sortField, $criteria->getSelectColumns())) { - $sortField = \UsersPeer::TABLE_NAME . '.' . $sortField; + if (in_array(UsersPeer::TABLE_NAME . '.' . $sortField, $criteria->getSelectColumns())) { + $sortField = UsersPeer::TABLE_NAME . '.' . $sortField; } else { $sortField = $sortFieldDefault; } @@ -2786,8 +2891,8 @@ class Cases $criteria->setLimit((int)($limit)); } - $rsCriteria = \UsersPeer::doSelectRS($criteria); - $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $rsCriteria = UsersPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); while ($rsCriteria->next()) { $row = $rsCriteria->getRow(); @@ -2797,11 +2902,11 @@ class Cases //Return return [ - 'total' => $numRecTotal, - 'start' => (int)((!is_null($start))? $start : 0), - 'limit' => (int)((!is_null($limit))? $limit : 0), - $filterName => (!is_null($arrayFilterData) && is_array($arrayFilterData) && isset($arrayFilterData['filter']))? $arrayFilterData['filter'] : '', - 'data' => $arrayUser + 'total' => $numRecTotal, + 'start' => (int)((!is_null($start)) ? $start : 0), + 'limit' => (int)((!is_null($limit)) ? $limit : 0), + $filterName => (!is_null($arrayFilterData) && is_array($arrayFilterData) && isset($arrayFilterData['filter'])) ? $arrayFilterData['filter'] : '', + 'data' => $arrayUser ]; } catch (Exception $e) { throw $e; @@ -2828,12 +2933,13 @@ class Cases } $dataResponse = $data; $casesToReassign = $data['cases']; - $oCases = new \Cases(); + $oCases = new ClassesCases(); foreach ($casesToReassign as $key => $val) { - $appDelegation = \AppDelegationPeer::retrieveByPK($val['APP_UID'], $val['DEL_INDEX']); + $appDelegation = AppDelegationPeer::retrieveByPK($val['APP_UID'], $val['DEL_INDEX']); $existDelegation = $this->validateReassignData($appDelegation, $val, $data, 'DELEGATION_NOT_EXISTS'); if ($existDelegation) { - $existDelegation = $this->validateReassignData($appDelegation, $val, $data, 'USER_NOT_ASSIGNED_TO_TASK'); + $existDelegation = $this->validateReassignData($appDelegation, $val, $data, + 'USER_NOT_ASSIGNED_TO_TASK'); if ($existDelegation) { $usrUid = ''; if (array_key_exists('USR_UID', $val)) { @@ -2842,16 +2948,19 @@ class Cases } } if ($usrUid == '') { - $fields = $appDelegation->toArray(\BasePeer::TYPE_FIELDNAME); + $fields = $appDelegation->toArray(BasePeer::TYPE_FIELDNAME); $usrUid = $fields['USR_UID']; } //Will be not able reassign a case when is paused - $flagPaused = $this->validateReassignData($appDelegation, $val, $data, 'ID_REASSIGNMENT_PAUSED_ERROR'); + $flagPaused = $this->validateReassignData($appDelegation, $val, $data, + 'ID_REASSIGNMENT_PAUSED_ERROR'); //Current users of OPEN DEL_INDEX thread - $flagSameUser = $this->validateReassignData($appDelegation, $val, $data, 'REASSIGNMENT_TO_THE_SAME_USER'); + $flagSameUser = $this->validateReassignData($appDelegation, $val, $data, + 'REASSIGNMENT_TO_THE_SAME_USER'); //reassign case if ($flagPaused && $flagSameUser) { - $reassigned = $oCases->reassignCase($val['APP_UID'], $val['DEL_INDEX'], $usrUid, $data['usr_uid_target']); + $reassigned = $oCases->reassignCase($val['APP_UID'], $val['DEL_INDEX'], $usrUid, + $data['usr_uid_target']); $result = $reassigned ? 1 : 0; $this->messageResponse = [ 'APP_UID' => $val['APP_UID'], @@ -2865,6 +2974,7 @@ class Cases $dataResponse['cases'][$key] = $this->messageResponse; } unset($dataResponse['usr_uid_target']); + return G::json_encode($dataResponse); } @@ -2891,8 +3001,8 @@ class Cases } break; case 'USER_NOT_ASSIGNED_TO_TASK': - $task = new \ProcessMaker\BusinessModel\Task(); - $supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor(); + $task = new BmTask(); + $supervisor = new BmProcessSupervisor(); $taskUid = $appDelegation->getTasUid(); $flagBoolean = $task->checkUserOrGroupAssignedTask($taskUid, $data['usr_uid_target']); $flagps = $supervisor->isUserProcessSupervisor($appDelegation->getProUid(), $data['usr_uid_target']); @@ -2908,12 +3018,12 @@ class Cases } break; case 'ID_REASSIGNMENT_PAUSED_ERROR': - if (\AppDelay::isPaused($value['APP_UID'], $value['DEL_INDEX'])) { + if (AppDelay::isPaused($value['APP_UID'], $value['DEL_INDEX'])) { $this->messageResponse = [ 'APP_UID' => $value['APP_UID'], 'DEL_INDEX' => $value['DEL_INDEX'], 'RESULT' => 0, - 'STATUS' => \G::LoadTranslation('ID_REASSIGNMENT_PAUSED_ERROR') + 'STATUS' => G::LoadTranslation('ID_REASSIGNMENT_PAUSED_ERROR') ]; $return = false; } @@ -2938,12 +3048,13 @@ class Cases 'APP_UID' => $value['APP_UID'], 'DEL_INDEX' => $value['DEL_INDEX'], 'RESULT' => 0, - 'STATUS' => \G::LoadTranslation('ID_REASSIGNMENT_ERROR') + 'STATUS' => G::LoadTranslation('ID_REASSIGNMENT_ERROR') ]; $return = false; } break; } + return $return; } @@ -2957,37 +3068,36 @@ class Cases */ public function caseAlreadyRouted($app_uid, $del_index, $usr_uid = '') { - $c = new \Criteria('workflow'); - $c->add(\AppDelegationPeer::APP_UID, $app_uid); - $c->add(\AppDelegationPeer::DEL_INDEX, $del_index); + $c = new Criteria('workflow'); + $c->add(AppDelegationPeer::APP_UID, $app_uid); + $c->add(AppDelegationPeer::DEL_INDEX, $del_index); if (!empty($usr_uid)) { - $c->add(\AppDelegationPeer::USR_UID, $usr_uid); + $c->add(AppDelegationPeer::USR_UID, $usr_uid); } - $c->add(\AppDelegationPeer::DEL_FINISH_DATE, null, \Criteria::ISNULL); - return !(boolean) \AppDelegationPeer::doCount($c); + $c->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL); + + return !(boolean)AppDelegationPeer::doCount($c); } public function checkUserHasPermissionsOrSupervisor($userUid, $applicationUid, $dynaformUid) { $arrayApplicationData = $this->getApplicationRecordByPk($applicationUid, [], false); //Check whether the process supervisor - $supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor(); + $supervisor = new BmProcessSupervisor(); $userAccess = $supervisor->isUserProcessSupervisor($arrayApplicationData['PRO_UID'], $userUid); if (!empty($dynaformUid)) { //Check if have objects assigned (Supervisor) - $cases = new \Cases(); - $resultDynaForm = $cases->getAllDynaformsStepsToRevise($applicationUid); - $flagSupervisors = false; - while ($resultDynaForm->next()) { - $row = $resultDynaForm->getRow(); - if ($row["STEP_UID_OBJ"] = $dynaformUid) { - $flagSupervisors = true; - break; - } - } + $flagSupervisors = $this->isSupervisorFromForm( + $userUid, + $applicationUid, + $dynaformUid, + $arrayApplicationData['PRO_UID'] + ); + //Check if have permissions VIEW - $case = new \Cases(); - $arrayAllObjectsFrom = $case->getAllObjectsFrom($arrayApplicationData['PRO_UID'], $applicationUid, '', $userUid, 'VIEW', 0); + $case = new ClassesCases(); + $arrayAllObjectsFrom = $case->getAllObjectsFrom($arrayApplicationData['PRO_UID'], $applicationUid, '', + $userUid, 'VIEW', 0); $flagPermissionsVIEW = false; if (array_key_exists('DYNAFORMS', $arrayAllObjectsFrom) && !empty($arrayAllObjectsFrom['DYNAFORMS']) @@ -2999,7 +3109,8 @@ class Cases } } //Check if have permissions BLOCK - $arrayAllObjectsFrom = $case->getAllObjectsFrom($arrayApplicationData['PRO_UID'], $applicationUid, '', $userUid, 'BLOCK', 0); + $arrayAllObjectsFrom = $case->getAllObjectsFrom($arrayApplicationData['PRO_UID'], $applicationUid, '', + $userUid, 'BLOCK', 0); $flagPermissionsBLOCK = false; if (array_key_exists('DYNAFORMS', $arrayAllObjectsFrom) && !empty($arrayAllObjectsFrom['DYNAFORMS']) @@ -3012,6 +3123,7 @@ class Cases } //check case Tracker $flagCaseTracker = $case->getAllObjectsTrackerDynaform($arrayApplicationData['PRO_UID'], $dynaformUid); + return ($flagSupervisors && $userAccess) || $flagPermissionsVIEW || $flagPermissionsBLOCK || $flagCaseTracker; } else { $arrayResult = $this->getStatusInfo($applicationUid, 0, $userUid); @@ -3019,6 +3131,7 @@ class Cases if ($arrayResult || $userAccess) { $flagParticipated = true; } + return $flagParticipated; } } @@ -3026,16 +3139,21 @@ class Cases /** * Delete MultipleFile in Case data * - * @param array $arrayApplicationData Case data - * @param string $variable1 Variable1 - * @param string $variable2 Variable2 - * @param string $type Type (NORMAL, GRID) - * @param array $arrayDocumentToDelete Document to delete + * @param array $arrayApplicationData Case data + * @param string $variable1 Variable1 + * @param string $variable2 Variable2 + * @param string $type Type (NORMAL, GRID) + * @param array $arrayDocumentToDelete Document to delete * * @return array Returns array with Case data updated */ - private function __applicationDataDeleteMultipleFile(array $arrayApplicationData, $variable1, $variable2, $type, array $arrayDocumentToDelete) - { + private function __applicationDataDeleteMultipleFile( + array $arrayApplicationData, + $variable1, + $variable2, + $type, + array $arrayDocumentToDelete + ) { if (array_key_exists($variable1, $arrayApplicationData) && is_array($arrayApplicationData[$variable1]) && !empty($arrayApplicationData[$variable1]) ) { @@ -3091,15 +3209,15 @@ class Cases /** * Delete MultipleFile * - * @param string $applicationUid Unique id of Case - * @param array $arrayVariableDocumentToDelete Variable with Documents to delete + * @param string $applicationUid Unique id of Case + * @param array $arrayVariableDocumentToDelete Variable with Documents to delete * * @return void */ public function deleteMultipleFile($applicationUid, array $arrayVariableDocumentToDelete) { - $case = new \Cases(); - $appDocument = new \AppDocument(); + $case = new ClassesCases(); + $appDocument = new AppDocument(); $arrayApplicationData = $this->getApplicationRecordByPk($applicationUid, [], false); $arrayApplicationData['APP_DATA'] = $case->unserializeData($arrayApplicationData['APP_DATA']); @@ -3166,7 +3284,7 @@ class Cases //The observations suggested by 'pull request' approver are applied (please see pull request). foreach ($arrayVariableDocumentToDelete as $key => $value) { if (isset($value['appDocUid'])) { - $appDocument->remove($value['appDocUid'], (int) (isset($value['version']) ? $value['version'] : 1)); + $appDocument->remove($value['appDocUid'], (int)(isset($value['version']) ? $value['version'] : 1)); if (is_string($arrayApplicationData['APP_DATA'][$key])) { try { $files = G::json_decode($arrayApplicationData['APP_DATA'][$key]); @@ -3177,7 +3295,8 @@ class Cases } $arrayApplicationData['APP_DATA'][$key] = G::json_encode($files); } catch (Exception $e) { - Bootstrap::registerMonolog('DeleteFile', 400, $e->getMessage(), $value, SYS_SYS, 'processmaker.log'); + Bootstrap::registerMonolog('DeleteFile', 400, $e->getMessage(), $value, SYS_SYS, + 'processmaker.log'); } } $flagDelete = true; @@ -3199,7 +3318,13 @@ class Cases * @param array $objectPermissions * @return array Returns array with all access */ - public function userAuthorization($usrUid, $proUid, $appUid, $rolesPermissions = array(), $objectPermissions = array()) { + public function userAuthorization( + $usrUid, + $proUid, + $appUid, + $rolesPermissions = array(), + $objectPermissions = array() + ) { $arrayAccess = array(); //User has participated @@ -3208,7 +3333,7 @@ class Cases $arrayAccess['participated'] = (count($aParticipated) == 0) ? false : true; //User is supervisor - $supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor(); + $supervisor = new BmProcessSupervisor(); $isSupervisor = $supervisor->isUserProcessSupervisor($proUid, $usrUid); $arrayAccess['supervisor'] = ($isSupervisor) ? true : false; @@ -3222,7 +3347,7 @@ class Cases //Object Permissions if (count($objectPermissions) > 0) { - $oCase = new \Cases(); + $oCase = new ClassesCases(); foreach ($objectPermissions as $key => $value) { $resPermission = $oCase->getAllObjectsFrom($proUid, $appUid, '', $usrUid, $value); if (isset($resPermission[$key])) { @@ -3274,13 +3399,13 @@ class Cases $result['USR_USERNAME'] = ''; global $RBAC; if (isset($RBAC) && isset($RBAC->aUserInfo)) { - $result['USER_LOGGED'] = $RBAC->aUserInfo['USER_INFO']['USR_UID']; - $result['USR_USERNAME'] = $RBAC->aUserInfo['USER_INFO']['USR_USERNAME']; + $result['USER_LOGGED'] = isset($RBAC->aUserInfo['USER_INFO']['USR_UID']) ? $RBAC->aUserInfo['USER_INFO']['USR_UID'] : ''; + $result['USR_USERNAME'] = isset($RBAC->aUserInfo['USER_INFO']['USR_USERNAME']) ? $RBAC->aUserInfo['USER_INFO']['USR_USERNAME'] : ''; } if (empty($result['USER_LOGGED'])) { $result['USER_LOGGED'] = Server::getUserId(); if (!empty($result['USER_LOGGED'])) { - $oUserLogged = new Users(); + $oUserLogged = new ModelUsers(); $oUserLogged->load($result['USER_LOGGED']); $result['USR_USERNAME'] = $oUserLogged->getUsrUsername(); } @@ -3288,6 +3413,7 @@ class Cases //the parameter dataVariable may contain additional elements $result = array_merge($dataVariable, $result); + return $result; } @@ -3304,18 +3430,19 @@ class Cases */ public function getLastParticipatedByUser($appUid, $userUid, $threadStatus = '') { - $criteria = new \Criteria('workflow'); - $criteria->addSelectColumn(\AppDelegationPeer::DEL_INDEX); - $criteria->addSelectColumn(\AppDelegationPeer::DEL_THREAD_STATUS); - $criteria->add(\AppDelegationPeer::APP_UID, $appUid, \Criteria::EQUAL); - $criteria->add(\AppDelegationPeer::USR_UID, $userUid, \Criteria::EQUAL); + $criteria = new Criteria('workflow'); + $criteria->addSelectColumn(AppDelegationPeer::DEL_INDEX); + $criteria->addSelectColumn(AppDelegationPeer::DEL_THREAD_STATUS); + $criteria->add(AppDelegationPeer::APP_UID, $appUid, Criteria::EQUAL); + $criteria->add(AppDelegationPeer::USR_UID, $userUid, Criteria::EQUAL); if (!empty($threadStatus)) { - $criteria->add(\AppDelegationPeer::DEL_THREAD_STATUS, $threadStatus, \Criteria::EQUAL); + $criteria->add(AppDelegationPeer::DEL_THREAD_STATUS, $threadStatus, Criteria::EQUAL); } - $dataSet = \AppDelegationPeer::doSelectRS($criteria); - $dataSet->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $dataSet = AppDelegationPeer::doSelectRS($criteria); + $dataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC); $dataSet->next(); $row = $dataSet->getRow(); + return isset($row['DEL_INDEX']) ? $row['DEL_INDEX'] : 0; } @@ -3332,68 +3459,79 @@ class Cases */ public function getOneLastThread($appUid, $checkCaseIsPaused = false) { - $criteria = new \Criteria('workflow'); - $criteria->addSelectColumn(\AppDelegationPeer::DEL_INDEX); - $criteria->addSelectColumn(\AppDelegationPeer::DEL_THREAD_STATUS); - $criteria->add(\AppDelegationPeer::APP_UID, $appUid, \Criteria::EQUAL); - $dataSet = \AppDelegationPeer::doSelectRS($criteria); - $dataSet->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $criteria = new Criteria('workflow'); + $criteria->addSelectColumn(AppDelegationPeer::DEL_INDEX); + $criteria->addSelectColumn(AppDelegationPeer::DEL_THREAD_STATUS); + $criteria->add(AppDelegationPeer::APP_UID, $appUid, Criteria::EQUAL); + $dataSet = AppDelegationPeer::doSelectRS($criteria); + $dataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC); $dataSet->next(); $row = $dataSet->getRow(); $delIndex = 0; while (is_array($row)) { $delIndex = $row['DEL_INDEX']; - if ($checkCaseIsPaused && \AppDelay::isPaused($appUid, $delIndex)) { + if ($checkCaseIsPaused && AppDelay::isPaused($appUid, $delIndex)) { return $delIndex; } $dataSet->next(); $row = $dataSet->getRow(); } + return $delIndex; } + /** * This function will be return the criteria for the search filter * * We considered in the search criteria the custom cases list, * the titles related to: caseTitle taskTitle processTitle and * the case number - * @param Criteria $criteria, must be contain the initial criteria for search - * @param string $listPeer, name of the list class - * @param string $search, the parameter for search in the table - * @param string $additionalClassName, name of the className of pmtable - * @param array $additionalColumns, columns related to the custom cases list + * @param Criteria $criteria , must be contain the initial criteria for search + * @param string $listPeer , name of the list class + * @param string $search , the parameter for search in the table + * @param string $additionalClassName , name of the className of pmtable + * @param array $additionalColumns , columns related to the custom cases list * @throws PropelException */ - public function getSearchCriteriaListCases(&$criteria, $listPeer ,$search, $additionalClassName = '', $additionalColumns = array() ) - { + public function getSearchCriteriaListCases( + &$criteria, + $listPeer, + $search, + $additionalClassName = '', + $additionalColumns = array() + ) { $oTmpCriteria = ''; //If we have additional tables configured in the custom cases list, prepare the variables for search if (count($additionalColumns) > 0) { require_once(PATH_DATA_SITE . 'classes' . PATH_SEP . $additionalClassName . '.php'); - $oNewCriteria = new \Criteria("workflow"); - $oTmpCriteria = $oNewCriteria->getNewCriterion(current($additionalColumns), "%" . $search . "%", \Criteria::LIKE); + $oNewCriteria = new Criteria("workflow"); + $oTmpCriteria = $oNewCriteria->getNewCriterion(current($additionalColumns), "%" . $search . "%", + Criteria::LIKE); //We prepare the query related to the custom cases list foreach (array_slice($additionalColumns, 1) as $value) { - $oTmpCriteria = $oNewCriteria->getNewCriterion($value, "%" . $search . "%", \Criteria::LIKE)->addOr($oTmpCriteria); + $oTmpCriteria = $oNewCriteria->getNewCriterion($value, "%" . $search . "%", + Criteria::LIKE)->addOr($oTmpCriteria); } } if (!empty($oTmpCriteria)) { $criteria->add( - $criteria->getNewCriterion($listPeer::APP_TITLE, '%' . $search . '%', \Criteria::LIKE)->addOr( - $criteria->getNewCriterion($listPeer::APP_TAS_TITLE, '%' . $search . '%', \Criteria::LIKE)->addOr( - $criteria->getNewCriterion($listPeer::APP_PRO_TITLE, '%' . $search . '%', \Criteria::LIKE)->addOr( - $criteria->getNewCriterion($listPeer::APP_NUMBER, $search, \Criteria::EQUAL)->addOr( - $oTmpCriteria - )))) + $criteria->getNewCriterion($listPeer::APP_TITLE, '%' . $search . '%', Criteria::LIKE)->addOr( + $criteria->getNewCriterion($listPeer::APP_TAS_TITLE, '%' . $search . '%', Criteria::LIKE)->addOr( + $criteria->getNewCriterion($listPeer::APP_PRO_TITLE, '%' . $search . '%', + Criteria::LIKE)->addOr( + $criteria->getNewCriterion($listPeer::APP_NUMBER, $search, Criteria::EQUAL)->addOr( + $oTmpCriteria + )))) ); } else { $criteria->add( - $criteria->getNewCriterion($listPeer::APP_TITLE, '%' . $search . '%', \Criteria::LIKE)->addOr( - $criteria->getNewCriterion($listPeer::APP_TAS_TITLE, '%' . $search . '%', \Criteria::LIKE)->addOr( - $criteria->getNewCriterion($listPeer::APP_PRO_TITLE, '%' . $search . '%', \Criteria::LIKE)->addOr( - $criteria->getNewCriterion($listPeer::APP_NUMBER, $search, \Criteria::EQUAL)))) + $criteria->getNewCriterion($listPeer::APP_TITLE, '%' . $search . '%', Criteria::LIKE)->addOr( + $criteria->getNewCriterion($listPeer::APP_TAS_TITLE, '%' . $search . '%', Criteria::LIKE)->addOr( + $criteria->getNewCriterion($listPeer::APP_PRO_TITLE, '%' . $search . '%', + Criteria::LIKE)->addOr( + $criteria->getNewCriterion($listPeer::APP_NUMBER, $search, Criteria::EQUAL)))) ); } } @@ -3402,23 +3540,29 @@ class Cases * This function get the table.column by order by the result * We can include the additional table related to the custom cases list * - * @param string $listPeer, name of the list class - * @param string $field, name of the fieldName - * @param string $sort, name of column by sort - * @param string $defaultSort, name of column by sort default - * @param string $additionalClassName, name of the className of pmTable - * @param array $additionalColumns, columns related to the custom cases list with the format TABLE_NAME.COLUMN_NAME + * @param string $listPeer , name of the list class + * @param string $field , name of the fieldName + * @param string $sort , name of column by sort + * @param string $defaultSort , name of column by sort default + * @param string $additionalClassName , name of the className of pmTable + * @param array $additionalColumns , columns related to the custom cases list with the format TABLE_NAME.COLUMN_NAME * @return string $tableName */ - public function getSortColumn($listPeer, $field, $sort, $defaultSort, $additionalClassName = '', $additionalColumns = array()) - { + public function getSortColumn( + $listPeer, + $field, + $sort, + $defaultSort, + $additionalClassName = '', + $additionalColumns = array() + ) { $columnSort = $defaultSort; $tableName = ''; //We will check if the column by sort is a LIST table $columnsList = $listPeer::getFieldNames($field); if (in_array($sort, $columnsList)) { - $columnSort = $listPeer::TABLE_NAME . '.' . $sort; + $columnSort = $listPeer::TABLE_NAME . '.' . $sort; } else { //We will sort by CUSTOM CASE LIST table if (count($additionalColumns) > 0) { @@ -3435,4 +3579,45 @@ class Cases return $columnSort; } + + /** + * This function verify if the user is a supervisor + * If we send the formUid we will to review if has the object form assigned + * + * @param string $usrUid, Uid related to the user + * @param string $appUid, Uid related to the case + * @param string $formUid, Uid related to the dynaform + * @param string $proUid, Uid related to the process + * + * @return boolean + */ + public function isSupervisorFromForm($usrUid, $appUid, $formUid, $proUid = '') + { + + //We will to search the proUid related to the appUid + if (empty($proUid)) { + $arrayApplicationData = $this->getApplicationRecordByPk($appUid, [], false); + $proUid = $arrayApplicationData['PRO_UID']; + } + + $supervisor = new BmProcessSupervisor(); + $isSupervisor = $supervisor->isUserProcessSupervisor($proUid, $usrUid); + + //We will check if the supervisor has the object form assigned + if ($isSupervisor) { + $cases = new ClassesCases(); + $resultDynaForm = $cases->getAllDynaformsStepsToRevise($appUid); + $isSupervisor = false; + while ($resultDynaForm->next()) { + $row = $resultDynaForm->getRow(); + //Review if the supervisor has the form assigned + if ($row["STEP_UID_OBJ"] === $formUid) { + $isSupervisor = true; + break; + } + } + } + + return $isSupervisor; + } } diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Cases.php b/workflow/engine/src/ProcessMaker/Services/Api/Cases.php index 47818ac73..fb09e7320 100644 --- a/workflow/engine/src/ProcessMaker/Services/Api/Cases.php +++ b/workflow/engine/src/ProcessMaker/Services/Api/Cases.php @@ -1,11 +1,20 @@ parameters[$arrayArgs['app_index']]; $userUid = $this->getUserId(); //Check if the user has the case - $appDelegation = new \AppDelegation(); + $appDelegation = new AppDelegation(); $aCurUser = $appDelegation->getCurrentUsers($applicationUid, $delIndex); if (!empty($aCurUser)) { foreach ($aCurUser as $key => $value) { @@ -52,16 +61,37 @@ class Cases extends Api } } //Check if the user has Permissions - $oCases = new \ProcessMaker\BusinessModel\Cases(); + $oCases = new BmCases(); return $oCases->checkUserHasPermissionsOrSupervisor($userUid, $applicationUid, $dynaformUid); break; + case 'doPutCaseVariables': + $applicationUid = $this->parameters[$arrayArgs['app_uid']]; + $dynaformUid = $this->parameters[$arrayArgs['dyn_uid']]; + $delIndex = $this->parameters[$arrayArgs['del_index']]; + $userUid = $this->getUserId(); + + //Check if the user has the case currently + $appDelegation = new AppDelegation(); + $currentUser = $appDelegation->getCurrentUsers($applicationUid, $delIndex); + foreach ($currentUser as $key => $value) { + if ($value === $userUid) { + return true; + } + } + + //Check if the user is a supervisor + //Unlike GET, it is not enough to have the processPermission for update the variables + $cases = new BmCases(); + $isSupervisor = $cases->isSupervisorFromForm($userUid, $applicationUid, $dynaformUid); + return $isSupervisor; + break; case 'doPostReassign': $arrayParameters = $this->parameters[0]['cases']; $usrUid = $this->getUserId(); //Check if the user is supervisor process - $case = new \ProcessMaker\BusinessModel\Cases(); - $user = new \ProcessMaker\BusinessModel\User(); + $case = new BmCases(); + $user = new BmUser(); $count = 0; @@ -71,7 +101,7 @@ class Cases extends Api if (!empty($arrayApplicationData)) { if (!$user->checkPermission($usrUid, 'PM_REASSIGNCASE')) { if ($user->checkPermission($usrUid, 'PM_REASSIGNCASE_SUPERVISOR')) { - $supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor(); + $supervisor = new BmProcessSupervisor(); $flagps = $supervisor->isUserProcessSupervisor($arrayApplicationData['PRO_UID'], $usrUid); if (!$flagps) { $count = $count + 1; @@ -90,20 +120,20 @@ class Cases extends Api $appUid = $this->parameters[$arrayArgs['app_uid']]; $usrUid = $this->getUserId(); //Check if the user is supervisor process - $case = new \ProcessMaker\BusinessModel\Cases(); - $user = new \ProcessMaker\BusinessModel\User(); + $case = new BmCases(); + $user = new BmUser(); $arrayApplicationData = $case->getApplicationRecordByPk($appUid, [], false); if (!empty($arrayApplicationData)) { - $criteria = new \Criteria("workflow"); - $criteria->addSelectColumn(\AppDelegationPeer::APP_UID); - $criteria->add(\AppDelegationPeer::APP_UID, $appUid); - $criteria->add(\AppDelegationPeer::USR_UID, $usrUid); + $criteria = new Criteria("workflow"); + $criteria->addSelectColumn(AppDelegationPeer::APP_UID); + $criteria->add(AppDelegationPeer::APP_UID, $appUid); + $criteria->add(AppDelegationPeer::USR_UID, $usrUid); $criteria->setLimit(1); - $rsCriteria = \AppDelegationPeer::doSelectRS($criteria); + $rsCriteria = AppDelegationPeer::doSelectRS($criteria); if ($rsCriteria->next()) { return true; } else { - $supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor(); + $supervisor = new BmProcessSupervisor(); $flagps = $supervisor->isUserProcessSupervisor($arrayApplicationData['PRO_UID'], $usrUid); return $flagps; } @@ -131,7 +161,7 @@ class Cases extends Api } return false; - } catch (\Exception $e) { + } catch (Exception $e) { throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); } } @@ -147,9 +177,7 @@ class Cases extends Api * @param string $pro_uid {@from path} * @param string $search {@from path} * @return array - * - * @author Brayan Pereyra (Cochalo) - * @copyright Colosa - Bolivia + * @throws Exception * * @url GET */ @@ -174,11 +202,11 @@ class Cases extends Api $dataList['category'] = $cat_uid; $dataList['process'] = $pro_uid; $dataList['search'] = $search; - $oCases = new \ProcessMaker\BusinessModel\Cases(); + $oCases = new BmCases(); $response = $oCases->getList($dataList); return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601); - } catch (\Exception $e) { + } catch (Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } } @@ -194,9 +222,7 @@ class Cases extends Api * @param string $pro_uid {@from path} * @param string $search {@from path} * @return array - * - * @author Brayan Pereyra (Cochalo) - * @copyright Colosa - Bolivia + * @throws Exception * * @url GET /paged */ @@ -221,10 +247,10 @@ class Cases extends Api $dataList['category'] = $cat_uid; $dataList['process'] = $pro_uid; $dataList['search'] = $search; - $oCases = new \ProcessMaker\BusinessModel\Cases(); + $oCases = new BmCases(); $response = $oCases->getList($dataList); return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601); - } catch (\Exception $e) { + } catch (Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } } @@ -240,9 +266,7 @@ class Cases extends Api * @param string $pro_uid {@from path} * @param string $search {@from path} * @return array - * - * @author Brayan Pereyra (Cochalo) - * @copyright Colosa - Bolivia + * @throws Exception * * @url GET /draft */ @@ -267,10 +291,10 @@ class Cases extends Api $dataList['category'] = $cat_uid; $dataList['process'] = $pro_uid; $dataList['search'] = $search; - $oCases = new \ProcessMaker\BusinessModel\Cases(); + $oCases = new BmCases(); $response = $oCases->getList($dataList); return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601); - } catch (\Exception $e) { + } catch (Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } } @@ -286,9 +310,7 @@ class Cases extends Api * @param string $pro_uid {@from path} * @param string $search {@from path} * @return array - * - * @author Brayan Pereyra (Cochalo) - * @copyright Colosa - Bolivia + * @throws Exception * * @url GET /draft/paged */ @@ -313,10 +335,10 @@ class Cases extends Api $dataList['category'] = $cat_uid; $dataList['process'] = $pro_uid; $dataList['search'] = $search; - $oCases = new \ProcessMaker\BusinessModel\Cases(); + $oCases = new BmCases(); $response = $oCases->getList($dataList); return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601); - } catch (\Exception $e) { + } catch (Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } } @@ -332,9 +354,7 @@ class Cases extends Api * @param string $pro_uid {@from path} * @param string $search {@from path} * @return array - * - * @author Brayan Pereyra (Cochalo) - * @copyright Colosa - Bolivia + * @throws Exception * * @url GET /participated */ @@ -359,10 +379,10 @@ class Cases extends Api $dataList['category'] = $cat_uid; $dataList['process'] = $pro_uid; $dataList['search'] = $search; - $oCases = new \ProcessMaker\BusinessModel\Cases(); + $oCases = new BmCases(); $response = $oCases->getList($dataList); return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601); - } catch (\Exception $e) { + } catch (Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } } @@ -378,9 +398,7 @@ class Cases extends Api * @param string $pro_uid {@from path} * @param string $search {@from path} * @return array - * - * @author Brayan Pereyra (Cochalo) - * @copyright Colosa - Bolivia + * @throws Exception * * @url GET /participated/paged */ @@ -405,10 +423,10 @@ class Cases extends Api $dataList['category'] = $cat_uid; $dataList['process'] = $pro_uid; $dataList['search'] = $search; - $oCases = new \ProcessMaker\BusinessModel\Cases(); + $oCases = new BmCases(); $response = $oCases->getList($dataList); return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601); - } catch (\Exception $e) { + } catch (Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } } @@ -424,9 +442,7 @@ class Cases extends Api * @param string $pro_uid {@from path} * @param string $search {@from path} * @return array - * - * @author Brayan Pereyra (Cochalo) - * @copyright Colosa - Bolivia + * @throws Exception * * @url GET /unassigned */ @@ -451,10 +467,10 @@ class Cases extends Api $dataList['category'] = $cat_uid; $dataList['process'] = $pro_uid; $dataList['search'] = $search; - $oCases = new \ProcessMaker\BusinessModel\Cases(); + $oCases = new BmCases(); $response = $oCases->getList($dataList); return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601); - } catch (\Exception $e) { + } catch (Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } } @@ -470,9 +486,7 @@ class Cases extends Api * @param string $pro_uid {@from path} * @param string $search {@from path} * @return array - * - * @author Brayan Pereyra (Cochalo) - * @copyright Colosa - Bolivia + * @throws Exception * * @url GET /unassigned/paged */ @@ -497,10 +511,10 @@ class Cases extends Api $dataList['category'] = $cat_uid; $dataList['process'] = $pro_uid; $dataList['search'] = $search; - $oCases = new \ProcessMaker\BusinessModel\Cases(); + $oCases = new BmCases(); $response = $oCases->getList($dataList); return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601); - } catch (\Exception $e) { + } catch (Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } } @@ -516,9 +530,7 @@ class Cases extends Api * @param string $pro_uid {@from path} * @param string $search {@from path} * @return array - * - * @author Brayan Pereyra (Cochalo) - * @copyright Colosa - Bolivia + * @throws Exception * * @url GET /paused */ @@ -543,10 +555,10 @@ class Cases extends Api $dataList['category'] = $cat_uid; $dataList['process'] = $pro_uid; $dataList['search'] = $search; - $oCases = new \ProcessMaker\BusinessModel\Cases(); + $oCases = new BmCases(); $response = $oCases->getList($dataList); return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601); - } catch (\Exception $e) { + } catch (Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } } @@ -562,9 +574,7 @@ class Cases extends Api * @param string $pro_uid {@from path} * @param string $search {@from path} * @return array - * - * @author Brayan Pereyra (Cochalo) - * @copyright Colosa - Bolivia + * @throws Exception * * @url GET /paused/paged */ @@ -589,10 +599,10 @@ class Cases extends Api $dataList['category'] = $cat_uid; $dataList['process'] = $pro_uid; $dataList['search'] = $search; - $oCases = new \ProcessMaker\BusinessModel\Cases(); + $oCases = new BmCases(); $response = $oCases->getList($dataList); return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601); - } catch (\Exception $e) { + } catch (Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } } @@ -612,9 +622,7 @@ class Cases extends Api * @param string $date_to {@from path} * @param string $search {@from path} * @return array - * - * @author Brayan Pereyra (Cochalo) - * @copyright Colosa - Bolivia + * @throws Exception * * @url GET /advanced-search */ @@ -647,10 +655,10 @@ class Cases extends Api $dataList['dateFrom'] = $date_from; $dataList['dateTo'] = $date_to; $dataList['search'] = $search; - $oCases = new \ProcessMaker\BusinessModel\Cases(); + $oCases = new BmCases(); $response = $oCases->getList($dataList); return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601); - } catch (\Exception $e) { + } catch (Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } } @@ -670,9 +678,7 @@ class Cases extends Api * @param string $date_to {@from path} * @param string $search {@from path} * @return array - * - * @author Brayan Pereyra (Cochalo) - * @copyright Colosa - Bolivia + * @throws Exception * * @url GET /advanced-search/paged */ @@ -705,10 +711,10 @@ class Cases extends Api $dataList['dateFrom'] = $date_from; $dataList['dateTo'] = $date_to; $dataList['search'] = $search; - $oCases = new \ProcessMaker\BusinessModel\Cases(); + $oCases = new BmCases(); $response = $oCases->getList($dataList); return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601); - } catch (\Exception $e) { + } catch (Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } } @@ -719,17 +725,19 @@ class Cases extends Api * @url GET /:app_uid * * @param string $app_uid {@min 32}{@max 32} + * @return array + * @throws Exception */ public function doGetCaseInfo($app_uid) { try { - $case = new \ProcessMaker\BusinessModel\Cases(); + $case = new BmCases(); $case->setFormatFieldNameInUppercase(false); $caseInfo = $case->getCaseInfo($app_uid, $this->getUserId()); $caseInfo = DateTime::convertUtcToIso8601($caseInfo, $this->arrayFieldIso8601); return $caseInfo; - } catch (\Exception $e) { + } catch (Exception $e) { throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); } } @@ -742,7 +750,7 @@ class Cases extends Api public function doGetTaskCase($app_uid) { try { - $case = new \ProcessMaker\BusinessModel\Cases(); + $case = new BmCases(); $case->setFormatFieldNameInUppercase(false); $arrayData = $case->getTaskCase($app_uid, $this->getUserId()); @@ -750,7 +758,7 @@ class Cases extends Api $response = $arrayData; return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601); - } catch (\Exception $e) { + } catch (Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } } @@ -767,10 +775,10 @@ class Cases extends Api { try { $userUid = $this->getUserId(); - $cases = new \ProcessMaker\BusinessModel\Cases(); + $cases = new BmCases(); $oData = $cases->addCase($pro_uid, $tas_uid, $userUid, $variables); return $oData; - } catch (\Exception $e) { + } catch (Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } } @@ -787,10 +795,10 @@ class Cases extends Api public function doPostCaseImpersonate($pro_uid, $usr_uid, $tas_uid, $variables = null) { try { - $cases = new \ProcessMaker\BusinessModel\Cases(); + $cases = new BmCases(); $oData = $cases->addCaseImpersonate($pro_uid, $usr_uid, $tas_uid, $variables); return $oData; - } catch (\Exception $e) { + } catch (Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } } @@ -807,9 +815,9 @@ class Cases extends Api { try { $userUid = $this->getUserId(); - $cases = new \ProcessMaker\BusinessModel\Cases(); + $cases = new BmCases(); $cases->updateReassignCase($app_uid, $userUid, $del_index, $usr_uid_source, $usr_uid_target); - } catch (\Exception $e) { + } catch (Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } } @@ -825,9 +833,9 @@ class Cases extends Api { try { $userUid = $this->getUserId(); - $cases = new \ProcessMaker\BusinessModel\Cases(); + $cases = new BmCases(); $cases->updateRouteCase($app_uid, $userUid, $del_index); - } catch (\Exception $e) { + } catch (Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } } @@ -846,9 +854,9 @@ class Cases extends Api { try { $userUid = $this->getUserId(); - $cases = new \ProcessMaker\BusinessModel\Cases(); + $cases = new BmCases(); $cases->putCancelCase($cas_uid, $userUid); - } catch (\Exception $e) { + } catch (Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } } @@ -858,9 +866,7 @@ class Cases extends Api * * @param string $cas_uid {@min 1}{@max 32} * @param string $unpaused_date {@from body} - * - * @author Brayan Pereyra (Cochalo) - * @copyright Colosa - Bolivia + * @throws Exception * * @url PUT /:cas_uid/pause */ @@ -868,13 +874,13 @@ class Cases extends Api { try { $userUid = $this->getUserId(); - $cases = new \ProcessMaker\BusinessModel\Cases(); + $cases = new BmCases(); if ($unpaused_date == null) { $cases->putPauseCase($cas_uid, $userUid); } else { $cases->putPauseCase($cas_uid, $userUid, false, $unpaused_date); } - } catch (\Exception $e) { + } catch (Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } } @@ -883,9 +889,7 @@ class Cases extends Api * Unpause Case * * @param string $cas_uid {@min 1}{@max 32} - * - * @author Brayan Pereyra (Cochalo) - * @copyright Colosa - Bolivia + * @throws Exception * * @url PUT /:cas_uid/unpause */ @@ -893,9 +897,9 @@ class Cases extends Api { try { $userUid = $this->getUserId(); - $cases = new \ProcessMaker\BusinessModel\Cases(); + $cases = new BmCases(); $cases->putUnpauseCase($cas_uid, $userUid); - } catch (\Exception $e) { + } catch (Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } } @@ -905,9 +909,7 @@ class Cases extends Api * * @param string $cas_uid {@min 1}{@max 32} * @param string $tri_uid {@min 1}{@max 32} - * - * @author Brayan Pereyra (Cochalo) - * @copyright Colosa - Bolivia + * @throws Exception * * @url PUT /:cas_uid/execute-trigger/:tri_uid */ @@ -915,9 +917,9 @@ class Cases extends Api { try { $userUid = $this->getUserId(); - $cases = new \ProcessMaker\BusinessModel\Cases(); + $cases = new BmCases(); $cases->putExecuteTriggerCase($cas_uid, $tri_uid, $userUid); - } catch (\Exception $e) { + } catch (Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } } @@ -926,9 +928,7 @@ class Cases extends Api * Delete Case * * @param string $cas_uid {@min 1}{@max 32} - * - * @author Brayan Pereyra (Cochalo) - * @copyright Colosa - Bolivia + * @throws Exception * * @url DELETE /:cas_uid */ @@ -936,9 +936,9 @@ class Cases extends Api { try { $usr_uid = $this->getUserId(); - $cases = new \ProcessMaker\BusinessModel\Cases(); + $cases = new BmCases(); $cases->deleteCase($cas_uid, $usr_uid); - } catch (\Exception $e) { + } catch (Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } } @@ -962,10 +962,10 @@ class Cases extends Api { try { $usr_uid = $this->getUserId(); - $cases = new \ProcessMaker\BusinessModel\Cases(); + $cases = new BmCases(); $response = $cases->getCaseVariables($app_uid, $usr_uid, $dyn_uid, $pro_uid, $act_uid, $app_index); return DateTime::convertUtcToIso8601($response); - } catch (\Exception $e) { + } catch (Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } } @@ -977,9 +977,7 @@ class Cases extends Api * @param array $request_data * @param string $dyn_uid {@from path} * @param int $del_index {@from path} - * - * @author Brayan Pereyra (Cochalo) - * @copyright Colosa - Bolivia + * @throws Exception * * @url PUT /:app_uid/variable */ @@ -987,10 +985,10 @@ class Cases extends Api { try { $usr_uid = $this->getUserId(); - $cases = new \ProcessMaker\BusinessModel\Cases(); + $cases = new BmCases(); $request_data = \ProcessMaker\Util\DateTime::convertDataToUtc($request_data); $cases->setCaseVariables($app_uid, $request_data, $dyn_uid, $usr_uid, $del_index); - } catch (\Exception $e) { + } catch (Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } } @@ -1008,9 +1006,7 @@ class Cases extends Api * @param string $date_to {@from path} * @param string $search {@from path} * @return array - * - * @author Brayan Pereyra (Cochalo) - * @copyright Colosa - Bolivia + * @throws Exception * * @url GET /:app_uid/notes */ @@ -1038,10 +1034,10 @@ class Cases extends Api $dataList['search'] = $search; $usr_uid = $this->getUserId(); - $cases = new \ProcessMaker\BusinessModel\Cases(); + $cases = new BmCases(); $response = $cases->getCaseNotes($app_uid, $usr_uid, $dataList); return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601); - } catch (\Exception $e) { + } catch (Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } } @@ -1058,9 +1054,7 @@ class Cases extends Api * @param string $date_to {@from path} * @param string $search {@from path} * @return array - * - * @author Brayan Pereyra (Cochalo) - * @copyright Colosa - Bolivia + * @throws Exception * * @url GET /:app_uid/notes/paged */ @@ -1086,10 +1080,10 @@ class Cases extends Api $dataList['search'] = $search; $usr_uid = $this->getUserId(); - $cases = new \ProcessMaker\BusinessModel\Cases(); + $cases = new BmCases(); $response = $cases->getCaseNotes($app_uid, $usr_uid, $dataList); return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601); - } catch (\Exception $e) { + } catch (Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } } @@ -1100,9 +1094,7 @@ class Cases extends Api * @param string $app_uid {@min 1}{@max 32} * @param string $note_content {@min 1}{@max 500} * @param int $send_mail {@choice 1,0} - * - * @author Brayan Pereyra (Cochalo) - * @copyright Colosa - Bolivia + * @throws Exception * * @url POST /:app_uid/note */ @@ -1110,10 +1102,10 @@ class Cases extends Api { try { $usr_uid = $this->getUserId(); - $cases = new \ProcessMaker\BusinessModel\Cases(); + $cases = new BmCases(); $send_mail = ($send_mail == 0) ? false : true; $cases->saveCaseNote($app_uid, $usr_uid, $note_content, $send_mail); - } catch (\Exception $e) { + } catch (Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } } @@ -1126,13 +1118,13 @@ class Cases extends Api public function doGetTasks($app_uid) { try { - $case = new \ProcessMaker\BusinessModel\Cases(); + $case = new BmCases(); $case->setFormatFieldNameInUppercase(false); $response = $case->getTasks($app_uid); return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601); - } catch (\Exception $e) { + } catch (Exception $e) { throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); } } @@ -1144,17 +1136,16 @@ class Cases extends Api * @param int $del_index {@from body} * @param string $obj_type {@from body} * @param string $obj_uid {@from body} - * - * @copyright Colosa - Bolivia + * @throws Exception * * @url PUT /:app_uid/execute-triggers */ public function doPutExecuteTriggers($app_uid, $del_index, $obj_type, $obj_uid) { try { - $cases = new \ProcessMaker\BusinessModel\Cases(); + $cases = new BmCases(); $cases->putExecuteTriggers($app_uid, $del_index, $obj_type, $obj_uid); - } catch (\Exception $e) { + } catch (Exception $e) { throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); } } @@ -1169,13 +1160,13 @@ class Cases extends Api public function doGetSteps($app_uid, $del_index) { try { - $case = new \ProcessMaker\BusinessModel\Cases(); + $case = new BmCases(); $case->setFormatFieldNameInUppercase(false); $response = $case->getSteps($app_uid, $del_index); return $response; - } catch (\Exception $e) { + } catch (Exception $e) { throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); } } @@ -1187,6 +1178,7 @@ class Cases extends Api * * @param string $type_view {@from path} * @return array + * @throws Exception * */ public function doGetCasesListStarCase( @@ -1194,12 +1186,12 @@ class Cases extends Api ) { try { $usr_uid = $this->getUserId(); - $case = new \ProcessMaker\BusinessModel\Cases(); + $case = new BmCases(); $response = $case->getCasesListStarCase($usr_uid, $type_view); return $response; - } catch (\Exception $e) { + } catch (Exception $e) { throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); } } @@ -1211,6 +1203,7 @@ class Cases extends Api * * @param string $type_view {@from path} * @return array + * @throws Exception * */ public function doGetCasesListBookmarkStarCase( @@ -1218,12 +1211,12 @@ class Cases extends Api ) { try { $usr_uid = $this->getUserId(); - $case = new \ProcessMaker\BusinessModel\Cases(); + $case = new BmCases(); $response = $case->getCasesListBookmarkStarCase($usr_uid, $type_view); return $response; - } catch (\Exception $e) { + } catch (Exception $e) { throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); } } @@ -1234,15 +1227,16 @@ class Cases extends Api * @url POST /bookmark/:tas_uid * * @param string $tas_uid {@min 32}{@max 32} + * @throws Exception * */ public function doPostBookmarkStartCase($tas_uid) { try { $userLoggedUid = $this->getUserId(); - $user = new \ProcessMaker\BusinessModel\User(); + $user = new BmUser(); $user->updateBookmark($userLoggedUid, $tas_uid, 'INSERT'); - } catch (\Exception $e) { + } catch (Exception $e) { throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); } } @@ -1252,15 +1246,16 @@ class Cases extends Api * @url DELETE /bookmark/:tas_uid * * @param string $tas_uid {@min 32}{@max 32} + * @throws Exception * */ public function doDeleteBookmarkStartCase($tas_uid) { try { $userLoggedUid = $this->getUserId(); - $user = new \ProcessMaker\BusinessModel\User(); + $user = new BmUser(); $user->updateBookmark($userLoggedUid, $tas_uid, 'DELETE'); - } catch (\Exception $e) { + } catch (Exception $e) { throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); } } @@ -1273,15 +1268,16 @@ class Cases extends Api * @class AccessControl {@className \ProcessMaker\Services\Api\Cases} * * @param array $request_data + * @throws Exception * */ public function doPostReassign($request_data) { try { - $case = new \ProcessMaker\BusinessModel\Cases(); + $case = new BmCases(); $response = $case->doPostReassign($request_data); return $response; - } catch (\Exception $e) { + } catch (Exception $e) { throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); } } diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Light.php b/workflow/engine/src/ProcessMaker/Services/Api/Light.php index d5d849b73..d0e27612b 100644 --- a/workflow/engine/src/ProcessMaker/Services/Api/Light.php +++ b/workflow/engine/src/ProcessMaker/Services/Api/Light.php @@ -1715,24 +1715,26 @@ class Light extends Api /** * Put Case Variables + * @access protected + * @class AccessControl {@className \ProcessMaker\Services\Api\Cases} + * @url PUT /:app_uid/variable * * @param string $app_uid {@min 1}{@max 32} * @param array $request_data * @param string $dyn_uid {@from path} * @param int $del_index {@from path} * - * @url PUT /:app_uid/variable + * @return void + * @throws RestException */ public function doPutCaseVariables($app_uid, $request_data, $dyn_uid = '', $del_index = 0) { try { //Check if the user is a supervisor or have permissions $usr_uid = $this->getUserId(); - $cases = new BusinessModelCases(); - $hasAccess = $cases->checkUserHasPermissionsOrSupervisor($usr_uid, $app_uid, $dyn_uid); //When the user is a supervisor del_index is 0 - if ($del_index <= 0 && !$hasAccess) { + if ($del_index < 0) { throw (new Exception(G::LoadTranslation('ID_INVALID_VALUE_EXPECTING_POSITIVE_INTEGER', array('del_index')), Api::STAT_APP_EXCEPTION)); } @@ -1740,6 +1742,7 @@ class Light extends Api throw (new Exception(G::LoadTranslation('ID_CAN_NOT_BE_NULL', array('del_index')), Api::STAT_APP_EXCEPTION)); } + $cases = new BusinessModelCases(); if ($del_index > 0) { if ($cases->caseAlreadyRouted($app_uid, $del_index, $usr_uid)) { throw (new Exception(G::LoadTranslation('ID_CASE_ALREADY_DERIVATED'), Api::STAT_APP_EXCEPTION)); From d0483f8b4417ac2b27dabbc1e5acabb3f3a855e6 Mon Sep 17 00:00:00 2001 From: Paula Quispe Date: Mon, 9 Oct 2017 16:19:12 -0400 Subject: [PATCH 31/85] HOR-3784 --- workflow/engine/bin/tasks/cliWorkspaces.php | 61 +++++ workflow/engine/classes/WorkspaceTools.php | 266 +++++++++++++------- workflow/engine/data/mysql/insert.sql | 3 +- 3 files changed, 243 insertions(+), 87 deletions(-) diff --git a/workflow/engine/bin/tasks/cliWorkspaces.php b/workflow/engine/bin/tasks/cliWorkspaces.php index 6b5f216c9..56a50872e 100644 --- a/workflow/engine/bin/tasks/cliWorkspaces.php +++ b/workflow/engine/bin/tasks/cliWorkspaces.php @@ -315,6 +315,17 @@ CLI::taskOpt("lang", "", "lLANG", "lang=LANG"); CLI::taskArg('workspace'); CLI::taskRun("cliListIds"); +/** + * Upgrade the CONTENT table + */ +CLI::taskName('upgrade-content'); +CLI::taskDescription(<<name); + } + } +} +/** + * This function will upgrade the CONTENT table for a workspace + * This function is executed only for one workspace + * @param array $args, workspaceName that we will to apply the command + * @param array $opts, we can send additional parameters + * + * @return void + */ +function upgradeContent($args, $opts) +{ + try { + //Load the attributes for the workspace + $arrayWorkspace = get_workspaces_from_args($args); + //Loop, read all the attributes related to the one workspace + $wsName = $arrayWorkspace[key($arrayWorkspace)]->name; + Bootstrap::setConstantsRelatedWs($wsName); + $workspaces = get_workspaces_from_args($args); + foreach ($workspaces as $workspace) { + try { + G::outRes("Upgrading content for " . pakeColor::colorize($workspace->name, "INFO") . "\n"); + $workspace->upgradeContent($workspace->name, true); + } catch (Exception $e) { + G::outRes("Errors upgrading content of workspace " . CLI::info($workspace->name) . ": " . CLI::error($e->getMessage()) . "\n"); + } + } + } catch (Exception $e) { + G::outRes(CLI::error($e->getMessage()) . "\n"); + } +} + /** * We will repair the translation in the languages defined in the workspace * Verify if we need to execute an external program for each workspace diff --git a/workflow/engine/classes/WorkspaceTools.php b/workflow/engine/classes/WorkspaceTools.php index 6edfc8bce..26ed884e5 100644 --- a/workflow/engine/classes/WorkspaceTools.php +++ b/workflow/engine/classes/WorkspaceTools.php @@ -57,6 +57,8 @@ class WorkspaceTools 'UPDATE LIST_UNASSIGNED_GROUP SET USR_ID=(SELECT USR_ID FROM USERS WHERE USERS.USR_UID=LIST_UNASSIGNED_GROUP.USR_UID)', ); + private $lastContentMigrateTable = false; + private $listContentMigrateTable = []; /** * Create a workspace tools object. @@ -76,6 +78,124 @@ class WorkspaceTools if ($this->workspaceExists()) { $this->getDBInfo(); } + $this->setListContentMigrateTable(); + } + + /** + * Gets the last content migrate table + * + * @return string + */ + public function getLastContentMigrateTable() + { + return $this->lastContentMigrateTable; + } + + /** + * Sets the last content migrate table + * + * @param string $tableColumn + * + */ + public function setLastContentMigrateTable($tableColumn) + { + $this->lastContentMigrateTable = $tableColumn; + } + + /** + * Gets the array for list content migrate table + * + * @return array + */ + public function getListContentMigrateTable() + { + return $this->listContentMigrateTable; + } + + /** + * Sets the array list content migrate table + */ + public function setListContentMigrateTable() + { + $migrateTables = array( + 'Groupwf' => array( + 'uid' => 'GRP_UID', + 'fields' => array('GRP_TITLE'), + 'methods' => array('exists' => 'GroupwfExists') + ), + 'Process' => array( + 'uid' => 'PRO_UID', + 'fields' => array('PRO_TITLE', 'PRO_DESCRIPTION'), + 'methods' => array('exists' => 'exists') + ), + 'Department' => array( + 'uid' => 'DEP_UID', + 'fields' => array('DEPO_TITLE'), + 'alias' => array('DEPO_TITLE' => 'DEP_TITLE'), + 'methods' => array('exists' => 'existsDepartment') + ), + 'Task' => array( + 'uid' => 'TAS_UID', + 'fields' => array('TAS_TITLE', 'TAS_DESCRIPTION', 'TAS_DEF_TITLE', 'TAS_DEF_SUBJECT_MESSAGE', 'TAS_DEF_PROC_CODE', 'TAS_DEF_MESSAGE', 'TAS_DEF_DESCRIPTION'), + 'methods' => array('exists' => 'taskExists') + ), + 'InputDocument' => array( + 'uid' => 'INP_DOC_UID', + 'fields' => array('INP_DOC_TITLE', 'INP_DOC_DESCRIPTION'), + 'methods' => array('exists' => 'InputExists') + ), + 'Application' => array( + 'uid' => 'APP_UID', + 'fields' => array('APP_TITLE', 'APP_DESCRIPTION'), + 'methods' => array('exists' => 'exists') + ), + 'AppDocument' => array( + 'uid' => 'APP_DOC_UID', + 'alias' => array('CON_PARENT' => 'DOC_VERSION'), + 'fields' => array('APP_DOC_TITLE', 'APP_DOC_COMMENT', 'APP_DOC_FILENAME'), + 'methods' => array('exists' => 'exists') + ), + 'Dynaform' => array( + 'uid' => 'DYN_UID', + 'fields' => array('DYN_TITLE', 'DYN_DESCRIPTION'), + 'methods' => array('exists' => 'exists') + ), + 'OutputDocument' => array( + 'uid' => 'OUT_DOC_UID', + 'fields' => array('OUT_DOC_TITLE', 'OUT_DOC_DESCRIPTION', 'OUT_DOC_FILENAME', 'OUT_DOC_TEMPLATE'), + 'methods' => array('exists' => 'OutputExists') + ), + 'ReportTable' => array( + 'uid' => 'REP_TAB_UID', + 'fields' => array('REP_TAB_TITLE'), + 'methods' => array('exists' => 'reportTableExists', 'update' => function ($row) { + $oRepTab = \ReportTablePeer::retrieveByPK($row['REP_TAB_UID']); + $oRepTab->fromArray($row, BasePeer::TYPE_FIELDNAME); + if ($oRepTab->validate()) { + $result = $oRepTab->save(); + } + }) + ), + 'Triggers' => array( + 'uid' => 'TRI_UID', + 'fields' => array('TRI_TITLE', 'TRI_DESCRIPTION'), + 'methods' => array('exists' => 'TriggerExists') + ), + '\ProcessMaker\BusinessModel\WebEntryEvent' => array( + 'uid' => 'WEE_UID', + 'fields' => array('WEE_TITLE', 'WEE_DESCRIPTION'), + 'methods' => array('exists' => 'exists', 'update' => function ($row) { + $webEntry = \WebEntryEventPeer::retrieveByPK($row['WEE_UID']); + $webEntry->fromArray($row, BasePeer::TYPE_FIELDNAME); + if ($webEntry->validate()) { + $result = $webEntry->save(); + } + }), + 'peer' => 'WebEntryEventPeer' + ) + ); + + $this->listContentMigrateTable = $migrateTables; } /** @@ -469,19 +589,52 @@ class WorkspaceTools /** * Upgrade this workspace Content. + * @param string $workspace + * @param boolean $executeRegenerateContent + * @return void */ - public function upgradeContent($workSpace = SYS_SYS) + public function upgradeContent($workspace = SYS_SYS, $executeRegenerateContent = false) { $this->initPropel(true); - //require_once 'classes/model/Translation.php'; - $translation = new Translation(); - $information = $translation->getTranslationEnvironments(); - $arrayLang = array(); - foreach ($information as $key => $value) { - $arrayLang[] = trim($value['LOCALE']); + //If the execute flag is false we will check if we needed + if (!$executeRegenerateContent) { + $conf = new Configuration(); + $blackList = []; + if ($conf->exists('MIGRATED_CONTENT', 'content')) { + $configData = $conf->load('MIGRATED_CONTENT', 'content'); + $blackList = unserialize($configData['CFG_VALUE']); + } + + $content = $this->getListContentMigrateTable(); + + foreach ($content as $className => $fields) { + //We check if all the label was migrated from content table + if (!in_array($className, $blackList)) { + $executeRegenerateContent = true; + break; + } + } + + //If the flag is not created we will check the last Content migration + //The $lastContentMigrateTable return true if content is migrated + if (!$executeRegenerateContent && !$this->getLastContentMigrateTable()) { + $executeRegenerateContent = true; + } } - $regenerateContent = new Content(); - $regenerateContent->regenerateContent($arrayLang, $workSpace); + + //We will to regenerate the Content table + if ($executeRegenerateContent) { + CLI::logging("-> Start To update...\n"); + $translation = new Translation(); + $information = $translation->getTranslationEnvironments(); + $arrayLang = []; + foreach ($information as $key => $value) { + $arrayLang[] = trim($value['LOCALE']); + } + $regenerateContent = new Content(); + $regenerateContent->regenerateContent($arrayLang, $workspace); + } + } /** @@ -1004,6 +1157,10 @@ class WorkspaceTools } } $workspaceSchema = $this->getSchema($rbac); + + //We will check if the database has the last content table migration + $this->checkLastContentMigrate($workspaceSchema); + $changes = System::compareSchema($workspaceSchema, $schema); $changed = (count($changes['tablesToAdd']) > 0 || count($changes['tablesToAlter']) > 0 || count($changes['tablesWithNewIndex']) > 0 || count($changes['tablesToAlterIndex']) > 0); @@ -3421,83 +3578,7 @@ class WorkspaceTools if ((!class_exists('Memcache') || !class_exists('Memcached')) && !defined('MEMCACHED_ENABLED')) { define('MEMCACHED_ENABLED', false); } - $content = array( - 'Groupwf' => array( - 'uid' => 'GRP_UID', - 'fields' => array('GRP_TITLE'), - 'methods' => array('exists' => 'GroupwfExists') - ), - 'Process' => array( - 'uid' => 'PRO_UID', - 'fields' => array('PRO_TITLE', 'PRO_DESCRIPTION'), - 'methods' => array('exists' => 'exists') - ), - 'Department' => array( - 'uid' => 'DEP_UID', - 'fields' => array('DEPO_TITLE'), - 'alias' => array('DEPO_TITLE' => 'DEP_TITLE'), - 'methods' => array('exists' => 'existsDepartment') - ), - 'Task' => array( - 'uid' => 'TAS_UID', - 'fields' => array('TAS_TITLE', 'TAS_DESCRIPTION', 'TAS_DEF_TITLE', 'TAS_DEF_SUBJECT_MESSAGE', 'TAS_DEF_PROC_CODE', 'TAS_DEF_MESSAGE', 'TAS_DEF_DESCRIPTION'), - 'methods' => array('exists' => 'taskExists') - ), - 'InputDocument' => array( - 'uid' => 'INP_DOC_UID', - 'fields' => array('INP_DOC_TITLE', 'INP_DOC_DESCRIPTION'), - 'methods' => array('exists' => 'InputExists') - ), - 'Application' => array( - 'uid' => 'APP_UID', - 'fields' => array('APP_TITLE', 'APP_DESCRIPTION'), - 'methods' => array('exists' => 'exists') - ), - 'AppDocument' => array( - 'uid' => 'APP_DOC_UID', - 'alias' => array('CON_PARENT' => 'DOC_VERSION'), - 'fields' => array('APP_DOC_TITLE', 'APP_DOC_COMMENT', 'APP_DOC_FILENAME'), - 'methods' => array('exists' => 'exists') - ), - 'Dynaform' => array( - 'uid' => 'DYN_UID', - 'fields' => array('DYN_TITLE', 'DYN_DESCRIPTION'), - 'methods' => array('exists' => 'exists') - ), - 'OutputDocument' => array( - 'uid' => 'OUT_DOC_UID', - 'fields' => array('OUT_DOC_TITLE', 'OUT_DOC_DESCRIPTION', 'OUT_DOC_FILENAME', 'OUT_DOC_TEMPLATE'), - 'methods' => array('exists' => 'OutputExists') - ), - 'ReportTable' => array( - 'uid' => 'REP_TAB_UID', - 'fields' => array('REP_TAB_TITLE'), - 'methods' => array('exists' => 'reportTableExists', 'update' => function ($row) { - $oRepTab = \ReportTablePeer::retrieveByPK($row['REP_TAB_UID']); - $oRepTab->fromArray($row, BasePeer::TYPE_FIELDNAME); - if ($oRepTab->validate()) { - $result = $oRepTab->save(); - } - }) - ), - 'Triggers' => array( - 'uid' => 'TRI_UID', - 'fields' => array('TRI_TITLE', 'TRI_DESCRIPTION'), - 'methods' => array('exists' => 'TriggerExists') - ), - '\ProcessMaker\BusinessModel\WebEntryEvent' => array( - 'uid' => 'WEE_UID', - 'fields' => array('WEE_TITLE', 'WEE_DESCRIPTION'), - 'methods' => array('exists' => 'exists', 'update' => function ($row) { - $webEntry = \WebEntryEventPeer::retrieveByPK($row['WEE_UID']); - $webEntry->fromArray($row, BasePeer::TYPE_FIELDNAME); - if ($webEntry->validate()) { - $result = $webEntry->save(); - } - }), - 'peer' => 'WebEntryEventPeer' - ) - ); + $content = $this->getListContentMigrateTable(); foreach ($content as $className => $fields) { if (!in_array($className, $blackList)) { @@ -3950,4 +4031,17 @@ class WorkspaceTools CLI::logging(" $path [" . (file_exists($path) ? 'OK' : 'MISSING') . "]\n"); } } + + /** + * This function get the last table migrated for the labels + * @param array $workspaceSchema, the current schema in the database + * @return void + */ + private function checkLastContentMigrate(array $workspaceSchema){ + $content = end($this->getListContentMigrateTable()); + $lastContent = isset($content['peer']) ? $content['peer'] : null; + if (!is_null($lastContent) && isset($workspaceSchema[$lastContent::TABLE_NAME][$content['fields'][0]])) { + $this->setLastContentMigrateTable(true); + } + } } diff --git a/workflow/engine/data/mysql/insert.sql b/workflow/engine/data/mysql/insert.sql index 524d1777b..7345d4a7e 100644 --- a/workflow/engine/data/mysql/insert.sql +++ b/workflow/engine/data/mysql/insert.sql @@ -61560,7 +61560,8 @@ INSERT INTO CONFIGURATION (CFG_UID,OBJ_UID,CFG_VALUE,PRO_UID,USR_UID,APP_UID) VA ('MIGRATED_LIST','list','true','list','list','list'), ('MIGRATED_LIST_UNASSIGNED','list','true','list','list','list'), ('SKIN_CRON','','s:10:"neoclassic";','','',''), -('AUDIT_LOG','log','s:5:"false";','','',''); +('AUDIT_LOG','log','s:5:"false";','','',''), +('MIGRATED_CONTENT', 'content', 'a:12:{i:0;s:7:"Groupwf";i:1;s:7:"Process";i:2;s:10:"Department";i:3;s:4:"Task";i:4;s:13:"InputDocument";i:5;s:11:"Application";i:6;s:11:"AppDocument";i:7;s:8:"Dynaform";i:8;s:14:"OutputDocument";i:9;s:11:"ReportTable";i:10;s:8:"Triggers";i:11;s:41:"\\ProcessMaker\\BusinessModel\\WebEntryEvent";}', '', '', ''); INSERT INTO CATALOG (CAT_UID, CAT_LABEL_ID, CAT_TYPE, CAT_FLAG, CAT_OBSERVATION, CAT_CREATE_DATE, CAT_UPDATE_DATE) VALUES ('10','ID_BARS','GRAPHIC','','','2015-03-04','2015-03-04'), From 8ac8e50691b93156f2cedb6bcd7b0c6e8252b4e8 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Tue, 10 Oct 2017 12:33:25 -0400 Subject: [PATCH 32/85] HOR-3851 --- framework/src/Maveriks/WebApplication.php | 18 +++++------ gulliver/bin/tasks/pakeGulliver.php | 2 +- gulliver/includes/inc.ajax.php | 2 +- gulliver/system/class.bootstrap.php | 16 +++++----- gulliver/system/class.dbMaintenance.php | 4 +-- gulliver/system/class.g.php | 14 ++++---- gulliver/system/class.headPublisher.php | 4 +-- gulliver/system/class.menu.php | 8 ++--- gulliver/system/class.pmException.php | 2 +- gulliver/system/class.table.php | 2 +- gulliver/system/class.wysiwygEditor.php | 2 +- gulliver/system/class.xmlform.php | 6 ++-- tests/WorkflowTestCase.php | 4 +-- .../ProcessMaker/BusinessModel/SkinsTest.php | 2 +- .../BusinessModel/WebEntryEventTest.php | 6 ++-- thirdparty/html2ps_pdf/config.inc.php | 2 +- thirdparty/pear/Log/file.php | 6 ++-- workflow/engine/PmBootstrap.php | 4 +-- workflow/engine/bin/cron_single.php | 8 ++--- workflow/engine/bin/reindex_solr.php | 10 +++--- workflow/engine/bin/tasks/cliAddons.php | 12 +++---- workflow/engine/bin/tasks/cliUpgrade.php | 6 ++-- workflow/engine/bin/tasks/cliWorkspaces.php | 6 ++-- workflow/engine/bin/verify_solr.php | 10 +++--- .../classes/ActionsByEmailCoreClass.php | 2 +- workflow/engine/classes/Applications.php | 2 +- workflow/engine/classes/Cases.php | 6 ++-- workflow/engine/classes/ConsolidatedCases.php | 2 +- workflow/engine/classes/Derivation.php | 2 +- workflow/engine/classes/EnterpriseClass.php | 4 +-- .../engine/classes/IndicatorsCalculator.php | 2 +- workflow/engine/classes/LdapAdvanced.php | 2 +- .../engine/classes/PMLicensedFeatures.php | 4 +-- workflow/engine/classes/PMPluginRegistry.php | 2 +- workflow/engine/classes/PmDrive.php | 2 +- workflow/engine/classes/PmDynaform.php | 18 +++++------ workflow/engine/classes/PmLicenseManager.php | 24 +++++++------- workflow/engine/classes/PmTable.php | 2 +- workflow/engine/classes/ProcessMap.php | 16 +++++----- workflow/engine/classes/Processes.php | 14 ++++---- workflow/engine/classes/ReportTables.php | 4 +-- workflow/engine/classes/ServerConf.php | 8 ++--- workflow/engine/classes/Upgrade.php | 2 +- workflow/engine/classes/WorkspaceTools.php | 14 ++++---- workflow/engine/classes/class.pmFunctions.php | 6 ++-- workflow/engine/classes/class.pmScript.php | 8 ++--- workflow/engine/classes/class.webdav.php | 12 +++---- .../engine/classes/model/AdditionalTables.php | 16 +++++----- workflow/engine/classes/model/AddonsStore.php | 2 +- .../engine/classes/model/CaseScheduler.php | 2 +- workflow/engine/classes/model/Content.php | 2 +- workflow/engine/classes/model/Process.php | 6 ++-- .../engine/classes/model/UsersProperties.php | 16 +++++----- workflow/engine/config/databases.php | 8 ++--- workflow/engine/controllers/admin.php | 2 +- workflow/engine/controllers/adminProxy.php | 10 +++--- .../engine/controllers/caseSchedulerProxy.php | 2 +- workflow/engine/controllers/designer.php | 4 +-- workflow/engine/controllers/home.php | 4 +-- workflow/engine/controllers/installer.php | 2 +- workflow/engine/controllers/main.php | 12 +++---- workflow/engine/controllers/pmTables.php | 2 +- workflow/engine/controllers/pmTablesProxy.php | 16 +++++----- .../engine/controllers/strategicDashboard.php | 4 +-- workflow/engine/controllers/webEntryProxy.php | 18 +++++------ .../engine/methods/cases/caseConsolidated.php | 2 +- .../cases/casesConsolidatedListExtJs.php | 2 +- .../engine/methods/cases/casesListExtJs.php | 4 +-- .../cases/cases_SaveDataSupervisor.php | 8 ++--- .../methods/cases/cases_SaveDocument.php | 12 +++---- .../cases/cases_SchedulerValidateUser.php | 2 +- .../methods/cases/cases_ShowDocument.php | 4 +-- .../cases/cases_ShowOutputDocument.php | 4 +-- workflow/engine/methods/cases/main_init.php | 2 +- .../engine/methods/enterprise/addonsStore.php | 4 +-- .../methods/enterprise/addonsStoreAction.php | 2 +- .../engine/methods/enterprise/enterprise.php | 10 +++--- .../methods/enterprise/processMakerAjax.php | 2 +- .../engine/methods/login/authentication.php | 8 ++--- .../methods/login/authenticationSso.php | 4 +-- workflow/engine/methods/login/login.php | 6 ++-- workflow/engine/methods/oauth2/grant.php | 2 +- .../engine/methods/processes/consolidated.php | 4 +-- .../engine/methods/processes/mainInit.php | 2 +- .../methods/processes/processesList.php | 2 +- .../methods/processes/processes_Ajax.php | 8 ++--- .../processes/processes_DownloadFile.php | 2 +- .../methods/processes/processes_Export.php | 2 +- .../processes/processes_Import_Ajax.php | 2 +- .../processes/processes_webEntryGenerate.php | 12 +++---- .../processes/processes_webEntryValidate.php | 2 +- .../methods/processes/webEntry_Val_Assig.php | 2 +- workflow/engine/methods/services/webdav.php | 2 +- workflow/engine/methods/services/wsdl2.php | 2 +- .../engine/methods/setup/auditLogAjax.php | 2 +- workflow/engine/methods/setup/cronAjax.php | 2 +- .../engine/methods/setup/languages_Import.php | 2 +- .../methods/setup/loginSettingsAjax.php | 2 +- .../engine/methods/setup/pluginsChange.php | 2 +- .../methods/setup/pluginsImportFile.php | 2 +- workflow/engine/methods/setup/pluginsList.php | 2 +- workflow/engine/methods/setup/pluginsMain.php | 2 +- .../engine/methods/setup/replacementLogo.php | 2 +- workflow/engine/methods/setup/skin_Ajax.php | 4 +-- workflow/engine/methods/setup/skinsList.php | 2 +- .../engine/methods/setup/webServicesAjax.php | 14 ++++---- .../engine/methods/setup/webServicesSetup.php | 2 +- .../methods/tracker/tracker_ShowDocument.php | 4 +-- .../tracker/tracker_ShowOutputDocument.php | 4 +-- .../engine/methods/triggers/triggers_Save.php | 2 +- workflow/engine/methods/users/usersEdit.php | 2 +- workflow/engine/methods/users/usersInit.php | 2 +- workflow/engine/methods/users/usersNew.php | 2 +- .../plugins/openFlash/class.openFlash.php | 2 +- .../pmosCommunity/class.pmosCommunity.php | 2 +- workflow/engine/skinEngine/skinEngine.php | 32 +++++++++---------- .../BusinessModel/ActionsByEmail.php | 2 +- .../src/ProcessMaker/BusinessModel/Cases.php | 2 +- .../BusinessModel/Cases/InputDocument.php | 20 ++++++------ .../BusinessModel/Consolidated.php | 4 +-- .../ProcessMaker/BusinessModel/EmailEvent.php | 2 +- .../BusinessModel/EmailServer.php | 2 +- .../src/ProcessMaker/BusinessModel/Light.php | 10 +++--- .../Light/NotificationDevice.php | 2 +- .../BusinessModel/MessageApplication.php | 4 +-- .../BusinessModel/Migrator/FileHandler.php | 2 +- .../BusinessModel/Migrator/FilesMigrator.php | 2 +- .../Migrator/GranularExporter.php | 4 +-- .../Migrator/TemplatesMigrator.php | 2 +- .../ProcessMaker/BusinessModel/Process.php | 6 ++-- .../BusinessModel/ProjectUser.php | 4 +-- .../src/ProcessMaker/BusinessModel/Skins.php | 2 +- .../src/ProcessMaker/BusinessModel/Table.php | 4 +-- .../ProcessMaker/BusinessModel/TimerEvent.php | 6 ++-- .../ProcessMaker/BusinessModel/Trigger.php | 2 +- .../src/ProcessMaker/BusinessModel/User.php | 2 +- .../ProcessMaker/BusinessModel/WebEntry.php | 4 +-- .../BusinessModel/WebEntryEvent.php | 4 +-- .../engine/src/ProcessMaker/Core/System.php | 2 +- .../src/ProcessMaker/Exporter/Exporter.php | 2 +- .../src/ProcessMaker/Importer/Importer.php | 2 +- .../ProcessMaker/Plugins/PluginRegistry.php | 6 ++-- .../engine/src/ProcessMaker/Project/Bpmn.php | 2 +- .../src/ProcessMaker/Project/Workflow.php | 6 ++-- .../src/ProcessMaker/Services/Api/Project.php | 4 +-- .../ProcessMaker/Services/OAuth2/Server.php | 10 +++--- .../ProcessMaker/Util/FixReferencePath.php | 2 +- .../engine/src/ProcessMaker/Util/System.php | 2 +- .../engine/src/ProcessMaker/Util/helpers.php | 4 +-- .../templates/setup/webServicesTree.php | 6 ++-- workflow/public_html/bootstrap.php | 14 ++++---- workflow/public_html/sysGeneric.php | 24 +++++++------- 152 files changed, 416 insertions(+), 416 deletions(-) diff --git a/framework/src/Maveriks/WebApplication.php b/framework/src/Maveriks/WebApplication.php index 331b956ec..094aac5b7 100644 --- a/framework/src/Maveriks/WebApplication.php +++ b/framework/src/Maveriks/WebApplication.php @@ -290,7 +290,7 @@ class WebApplication } // Setting current workspace to Api class - Services\Api::setWorkspace(config("sys_sys")); + Services\Api::setWorkspace(config("system.workspace")); $cacheDir = defined("PATH_WORKSPACE") ? PATH_WORKSPACE : (defined("PATH_C") ? PATH_C : sys_get_temp_dir()); $sysConfig = System::getSystemConfiguration(); @@ -387,7 +387,7 @@ class WebApplication } } - Services\OAuth2\Server::setWorkspace(config("sys_sys")); + Services\OAuth2\Server::setWorkspace(config("system.workspace")); $this->rest->addAPIClass('\ProcessMaker\\Services\\OAuth2\\Server', 'oauth2'); return $uri; @@ -498,16 +498,16 @@ class WebApplication } define("SYS_SYS", $workspace); - config(["sys_sys" => $workspace]); + config(["system.workspace" => $workspace]); - if (!file_exists(PATH_DB . config("sys_sys") . PATH_SEP . "db.php")) { + if (!file_exists(PATH_DB . config("system.workspace") . PATH_SEP . "db.php")) { $rest = new \Maveriks\Extension\Restler(); $rest->setMessage(new RestException(Api::STAT_APP_EXCEPTION, \G::LoadTranslation("ID_NOT_WORKSPACE"))); exit(0); } - $arraySystemConfiguration = System::getSystemConfiguration('', '', config("sys_sys")); + $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']); @@ -525,11 +525,11 @@ class WebApplication define('SYS_SKIN', $arraySystemConfiguration['default_skin']); define('DISABLE_DOWNLOAD_DOCUMENTS_SESSION_VALIDATION', $arraySystemConfiguration['disable_download_documents_session_validation']); - require_once(PATH_DB . config("sys_sys") . "/db.php"); + require_once(PATH_DB . config("system.workspace") . "/db.php"); // defining constant for workspace shared directory - $this->workspaceDir = PATH_DB . config("sys_sys") . PATH_SEP; - $this->workspaceCacheDir = PATH_DB . config("sys_sys") . PATH_SEP . "cache" . PATH_SEP; + $this->workspaceDir = PATH_DB . config("system.workspace") . PATH_SEP; + $this->workspaceCacheDir = PATH_DB . config("system.workspace") . PATH_SEP . "cache" . PATH_SEP; define("PATH_WORKSPACE", $this->workspaceDir); // including workspace shared classes -> particularlly for pmTables @@ -540,7 +540,7 @@ class WebApplication define("PATH_SMARTY_C", PATH_C . "smarty" . PATH_SEP . "c"); define("PATH_SMARTY_CACHE", PATH_C . "smarty" . PATH_SEP . "cache"); - define("PATH_DATA_SITE", PATH_DATA . "sites/" . config("sys_sys") . "/"); + define("PATH_DATA_SITE", PATH_DATA . "sites/" . config("system.workspace") . "/"); define("PATH_DOCUMENT", PATH_DATA_SITE . "files/"); define("PATH_DATA_MAILTEMPLATES", PATH_DATA_SITE . "mailTemplates/"); define("PATH_DATA_PUBLIC", PATH_DATA_SITE . "public/"); diff --git a/gulliver/bin/tasks/pakeGulliver.php b/gulliver/bin/tasks/pakeGulliver.php index 9400e1d34..18e3600b1 100644 --- a/gulliver/bin/tasks/pakeGulliver.php +++ b/gulliver/bin/tasks/pakeGulliver.php @@ -2232,7 +2232,7 @@ function run_update_plugin_attributes($task, $args) // virtual SYS_SYS for cache $sys_sys = uniqid(); define('SYS_SYS', $sys_sys); - config(["sys_sys" => $sys_sys]); + config(["system.workspace" => $sys_sys]); foreach (PmSystem::listWorkspaces() as $value) { \ProcessMaker\Util\Cnn::connect($value->name); //Update plugin attributes diff --git a/gulliver/includes/inc.ajax.php b/gulliver/includes/inc.ajax.php index 733126849..e45099ece 100644 --- a/gulliver/includes/inc.ajax.php +++ b/gulliver/includes/inc.ajax.php @@ -107,5 +107,5 @@ } function ajax_LoadJavaScript( $phpMethod, $phpFile ) { - print ' LoadPopJavaScript ( "/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/tools/loadJavaScript.html?method=' .$phpMethod . '&file=' . $phpFile . "\");\n"; + print ' LoadPopJavaScript ( "/sys' . config("system.workspace") . '/' . SYS_LANG . '/' . SYS_SKIN . '/tools/loadJavaScript.html?method=' .$phpMethod . '&file=' . $phpFile . "\");\n"; } diff --git a/gulliver/system/class.bootstrap.php b/gulliver/system/class.bootstrap.php index 62dbd70d3..40d1f90a4 100644 --- a/gulliver/system/class.bootstrap.php +++ b/gulliver/system/class.bootstrap.php @@ -2121,8 +2121,8 @@ class Bootstrap $sysCon["SYS_SKIN"] = SYS_SKIN; } - if (defined("SYS_SYS")) { - $sysCon["SYS_SYS"] = config("sys_sys"); + if (!empty(config("system.workspace"))) { + $sysCon["SYS_SYS"] = config("system.workspace"); } $sysCon["APPLICATION"] = (isset($_SESSION["APPLICATION"])) ? $_SESSION["APPLICATION"] : ""; @@ -2682,7 +2682,7 @@ class Bootstrap * @return array $aContext void */ public static function getDefaultContextLog(){ - $sysSys = (defined("SYS_SYS"))? config("sys_sys") : "Undefined"; + $sysSys = (!empty(config("system.workspace")))? config("system.workspace") : "Undefined"; $date = \ProcessMaker\Util\DateTime::convertUtcToTimeZone(date('Y-m-d H:m:s')); $aContext = array( 'ip' => \G::getIpAddress() @@ -2722,7 +2722,7 @@ class Bootstrap $context['url'] = SYS_CURRENT_URI . '?' . SYS_CURRENT_PARMS; } $context['usrUid'] = isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : ''; - $sysSys = defined("SYS_SYS") ? config("sys_sys") : "Undefined"; + $sysSys = !empty(config("system.workspace")) ? config("system.workspace") : "Undefined"; \Bootstrap::registerMonolog($channel, $level, $message, $context, $sysSys, 'processmaker.log'); } @@ -2734,13 +2734,13 @@ class Bootstrap * @return void */ public static function setConstantsRelatedWs($wsName = null) { - if (!defined('SYS_SYS') && !is_null($wsName)) { + if (empty(config("system.workspace")) && !is_null($wsName)) { //If SYS_SYS exists, is not update with $wsName define('SYS_SYS', $wsName); - config(["sys_sys" => $wsName]); + config(["system.workspace" => $wsName]); } - if (defined('SYS_SYS') && !defined('PATH_DATA_SITE')) { - define('PATH_DATA_SITE', PATH_DATA . 'sites' . PATH_SEP . config("sys_sys") . PATH_SEP); + if (!empty(config("system.workspace")) && !defined('PATH_DATA_SITE')) { + define('PATH_DATA_SITE', PATH_DATA . 'sites' . PATH_SEP . config("system.workspace") . PATH_SEP); } if (defined('PATH_DATA_SITE') && !defined('PATH_WORKSPACE')) { define('PATH_WORKSPACE', PATH_DATA_SITE); diff --git a/gulliver/system/class.dbMaintenance.php b/gulliver/system/class.dbMaintenance.php index 7b0c640e8..aa2c9058d 100644 --- a/gulliver/system/class.dbMaintenance.php +++ b/gulliver/system/class.dbMaintenance.php @@ -267,7 +267,7 @@ class DataBaseMaintenance // Commented that is not assigned to a variable. // mysql_escape_string("';"); if (! @mysql_query( $sql )) { - $ws = (defined("SYS_SYS"))? config("sys_sys") : "Wokspace Undefined"; + $ws = (!empty(config("system.workspace")))? config("system.workspace") : "Wokspace Undefined"; Bootstrap::registerMonolog('MysqlCron', 400, mysql_error(), array('sql'=>$sql), $ws, 'processmaker.log'); $varRes = mysql_error() . "\n"; G::outRes( $varRes ); @@ -288,7 +288,7 @@ class DataBaseMaintenance $tableName = str_replace( '.dump', '', basename( $backupFile ) ); $sql = "LOAD DATA INFILE '$backupFile' INTO TABLE $tableName FIELDS TERMINATED BY '\t|\t' OPTIONALLY ENCLOSED BY '\"' LINES TERMINATED BY '\t\t\r\r\n'"; if (! @mysql_query( $sql )) { - $ws = (defined("SYS_SYS"))? config("sys_sys") : "Wokspace Undefined"; + $ws = (!empty(config("system.workspace")))? config("system.workspace") : "Wokspace Undefined"; Bootstrap::registerMonolog('MysqlCron', 400, mysql_error(), array('sql'=>$sql), $ws, 'processmaker.log'); $varRes = mysql_error() . "\n"; G::outRes( $varRes ); diff --git a/gulliver/system/class.g.php b/gulliver/system/class.g.php index 67ba14288..096906d9b 100644 --- a/gulliver/system/class.g.php +++ b/gulliver/system/class.g.php @@ -2448,7 +2448,7 @@ class G global $RBAC; if (isset( $_SESSION['USER_LOGGED'] ) && $_SESSION['USER_LOGGED'] == '') { - $sys = (ENABLE_ENCRYPT == 'yes' ? config("sys_sys") : "sys" . config("sys_sys")); + $sys = (ENABLE_ENCRYPT == 'yes' ? config("system.workspace") : "sys" . config("system.workspace")); $lang = (ENABLE_ENCRYPT == 'yes' ? G::encrypt( urldecode( SYS_LANG ), URL_KEY ) : SYS_LANG); $skin = (ENABLE_ENCRYPT == 'yes' ? G::encrypt( urldecode( SYS_SKIN ), URL_KEY ) : SYS_SKIN); $login = (ENABLE_ENCRYPT == 'yes' ? G::encrypt( urldecode( 'login' ), URL_KEY ) : 'login'); @@ -2466,7 +2466,7 @@ class G $sessionBrowser = defined( 'SESSION_BROWSER' ) ? SESSION_BROWSER : ''; if (($sessionPc == "1") or ($sessionBrowser == "1")) { if ($row['LOG_STATUS'] == 'X') { - $sys = (ENABLE_ENCRYPT == 'yes' ? config("sys_sys") : "sys" . config("sys_sys")); + $sys = (ENABLE_ENCRYPT == 'yes' ? config("system.workspace") : "sys" . config("system.workspace")); $lang = (ENABLE_ENCRYPT == 'yes' ? G::encrypt( urldecode( SYS_LANG ), URL_KEY ) : SYS_LANG); $skin = (ENABLE_ENCRYPT == 'yes' ? G::encrypt( urldecode( SYS_SKIN ), URL_KEY ) : SYS_SKIN); $login = (ENABLE_ENCRYPT == 'yes' ? G::encrypt( urldecode( 'login' ), URL_KEY ) : 'login'); @@ -2502,7 +2502,7 @@ class G if ($sw == 0 && $urlNoAccess != "") { $aux = explode( '/', $urlNoAccess ); - $sys = (ENABLE_ENCRYPT == 'yes' ? config("sys_sys") : "/sys" . SYS_LANG); + $sys = (ENABLE_ENCRYPT == 'yes' ? config("system.workspace") : "/sys" . SYS_LANG); $lang = (ENABLE_ENCRYPT == 'yes' ? G::encrypt( urldecode( SYS_LANG ), URL_KEY ) : SYS_LANG); $skin = (ENABLE_ENCRYPT == 'yes' ? G::encrypt( urldecode( SYS_SKIN ), URL_KEY ) : SYS_SKIN); $login = (ENABLE_ENCRYPT == 'yes' ? G::encrypt( urldecode( $aux[0] ), URL_KEY ) : $aux[0]); @@ -2563,7 +2563,7 @@ class G { $configuration = new Configurations(); - if (defined('SYS_SYS') && $configuration->exists("ENVIRONMENT_SETTINGS")) { + if (!empty(config("system.workspace")) && $configuration->exists("ENVIRONMENT_SETTINGS")) { return ($configuration->getDirectoryStructureVer() > 1); } return false; @@ -2976,8 +2976,8 @@ class G $sysCon["SYS_SKIN"] = SYS_SKIN; } - if (defined("SYS_SYS")) { - $sysCon["SYS_SYS"] = config("sys_sys"); + if (!empty(config("system.workspace"))) { + $sysCon["SYS_SYS"] = config("system.workspace"); } $sysCon["APPLICATION"] = (isset($_SESSION["APPLICATION"]))? $_SESSION["APPLICATION"] : ""; @@ -5445,7 +5445,7 @@ class G */ public static function auditLog($actionToLog, $valueToLog = "") { - $workspace = defined('SYS_SYS') ? config("sys_sys") : 'Wokspace Undefined'; + $workspace = !empty(config("system.workspace")) ? config("system.workspace") : 'Wokspace Undefined'; $conf = new Configurations(); $sflag = $conf->getConfiguration('AUDIT_LOG', 'log'); $sflagAudit = $sflag == 'true' ? true : false; diff --git a/gulliver/system/class.headPublisher.php b/gulliver/system/class.headPublisher.php index b1f7f5838..0f0503c61 100644 --- a/gulliver/system/class.headPublisher.php +++ b/gulliver/system/class.headPublisher.php @@ -388,7 +388,7 @@ class headPublisher */ // Load external/plugin css // NOTE is necesary to move this to decorator server - if (class_exists('ProcessMaker\Plugins\PluginRegistry') && defined('SYS_SYS')) { + if (class_exists('ProcessMaker\Plugins\PluginRegistry') && !empty(config("system.workspace"))) { $oPluginRegistry = PluginRegistry::loadSingleton(); $registeredCss = $oPluginRegistry->getRegisteredCss(); /** @var \ProcessMaker\Plugins\Interfaces\CssFile $cssFile */ @@ -553,7 +553,7 @@ class headPublisher $this->extJsScript[] = '/extjs/' . $cacheName; //hook for registered javascripts from plugins - if (class_exists('ProcessMaker\Plugins\PluginRegistry') && defined('SYS_SYS')) { + if (class_exists('ProcessMaker\Plugins\PluginRegistry') && !empty(config("system.workspace"))) { $oPluginRegistry = PluginRegistry::loadSingleton(); $pluginJavascripts = $oPluginRegistry->getRegisteredJavascriptBy($filename); } else { diff --git a/gulliver/system/class.menu.php b/gulliver/system/class.menu.php index d1137a852..a4af06841 100644 --- a/gulliver/system/class.menu.php +++ b/gulliver/system/class.menu.php @@ -310,9 +310,9 @@ class Menu $target = $this->Options[$intPos]; if ($this->Types[$intPos] != "absolute") { if (defined('ENABLE_ENCRYPT')) { - $target = "/sys" . config("sys_sys") . "/" . SYS_LANG . "/" . SYS_SKIN . "/" . $target; - } elseif (defined('SYS_SYS')) { - $target = "/sys" . config("sys_sys") . "/" . SYS_LANG . "/" . SYS_SKIN . "/" . $target; + $target = "/sys" . config("system.workspace") . "/" . SYS_LANG . "/" . SYS_SKIN . "/" . $target; + } elseif (!empty(config("system.workspace"))) { + $target = "/sys" . config("system.workspace") . "/" . SYS_LANG . "/" . SYS_SKIN . "/" . $target; } else { $target = "/sys/" . SYS_LANG . "/" . SYS_SKIN . "/" . $target; } @@ -358,7 +358,7 @@ class Menu $target = $this->Options[$ncount]; } if ($this->Types[$ncount] != 'absolute') { - if (defined('SYS_SYS')) { + if (!empty(config("system.workspace"))) { $target = '/sys' . SYS_TEMP . G::encryptLink('/' . SYS_LANG . '/' . SYS_SKIN . '/' . $this->Options[$ncount]); } else { $target = '/sys/' . G::encryptLink(SYS_LANG . '/' . SYS_SKIN . '/' . $this->Options[$ncount]); diff --git a/gulliver/system/class.pmException.php b/gulliver/system/class.pmException.php index edd805e60..964ed9651 100644 --- a/gulliver/system/class.pmException.php +++ b/gulliver/system/class.pmException.php @@ -21,7 +21,7 @@ class PMException extends Exception } public static function registerErrorLog($error, $token){ - $ws = (defined("SYS_SYS"))? config("sys_sys") : "Wokspace Undefined"; + $ws = (!empty(config("system.workspace")))? config("system.workspace") : "Wokspace Undefined"; Bootstrap::registerMonolog('ExceptionCron', 400, $error->getMessage(), array('token'=>$token), $ws, 'processmaker.log'); } } diff --git a/gulliver/system/class.table.php b/gulliver/system/class.table.php index ed1e3157f..de33b99ce 100644 --- a/gulliver/system/class.table.php +++ b/gulliver/system/class.table.php @@ -461,7 +461,7 @@ class Table //$res .= "" . $this->Labels[$intPos] . ""; diff --git a/gulliver/system/class.wysiwygEditor.php b/gulliver/system/class.wysiwygEditor.php index 53ed946cf..9d76da2df 100644 --- a/gulliver/system/class.wysiwygEditor.php +++ b/gulliver/system/class.wysiwygEditor.php @@ -75,7 +75,7 @@ class XmlFormFieldWYSIWYGEditor extends XmlFormField public function attachEvents ($element) { $editorDefinition = 'tinyMCE.baseURL = "/js/tinymce/jscripts/tiny_mce"; '; - $editorDefinition .= 'var domainURL = "/sys'.config("sys_sys").'/'.SYS_LANG.'/'.SYS_SKIN.'/"'; + $editorDefinition .= 'var domainURL = "/sys'.config("system.workspace").'/'.SYS_LANG.'/'.SYS_SKIN.'/"'; $serverConf =& ServerConf::getSingleton(); switch ($this->editorType){ diff --git a/gulliver/system/class.xmlform.php b/gulliver/system/class.xmlform.php index 0b4b4eeab..2a45bb092 100644 --- a/gulliver/system/class.xmlform.php +++ b/gulliver/system/class.xmlform.php @@ -255,7 +255,7 @@ class XmlFormField $rs = $con->executeQuery( $query, ResultSet::FETCHMODE_NUM ); } catch (Exception $e) { //dismiss error because dbarray shouldnt be defined in some contexts. - $workspace = defined("SYS_SYS")? config("sys_sys") : "Wokspace Undefined"; + $workspace = !empty(config("system.workspace"))? config("system.workspace") : "Wokspace Undefined"; G::log($workspace . " | ip: | " . G::getIpAddress() . " | type error: | " . $e->getMessage() . " | query: " . $query, PATH_DATA, "queriesWithErrors.log"); return $result; @@ -267,7 +267,7 @@ class XmlFormField $rs = $stmt->executeQuery( $query, ResultSet::FETCHMODE_NUM ); } catch (Exception $e) { //dismiss error because dbarray shouldnt be defined in some contexts. - $workspace = defined("SYS_SYS")? config("sys_sys") : "Wokspace Undefined"; + $workspace = !empty(config("system.workspace"))? config("system.workspace") : "Wokspace Undefined"; G::log($workspace . " | ip: | " . G::getIpAddress() . " | type error: | " . $e->getMessage() . " | query: " . $query, PATH_DATA, "queriesWithErrors.log"); return $result; @@ -5482,7 +5482,7 @@ class XmlForm $this->fileName = $filename; $parsedFile = dirname( $filename ) . PATH_SEP . basename( $filename, 'xml' ) . $language; - $parsedFilePath = defined( 'PATH_C' ) ? (defined( 'SYS_SYS' ) ? PATH_C . 'ws' . PATH_SEP . config("sys_sys") . PATH_SEP : PATH_C) : PATH_DATA; + $parsedFilePath = defined('PATH_C') ? (!empty(config("system.workspace")) ? PATH_C . 'ws' . PATH_SEP . config("system.workspace") . PATH_SEP : PATH_C) : PATH_DATA; $parsedFilePath .= 'xmlform/' . substr( $parsedFile, strlen( $this->home ) ); // Improvement for the js cache - Start diff --git a/tests/WorkflowTestCase.php b/tests/WorkflowTestCase.php index 2dcb6547d..6e7969149 100644 --- a/tests/WorkflowTestCase.php +++ b/tests/WorkflowTestCase.php @@ -28,7 +28,7 @@ class WorkflowTestCase extends TestCase $pdo->exec(file_get_contents(PATH_RBAC_CORE.'data/mysql/insert.sql')); $pdo->exec("INSERT INTO `APP_SEQUENCE` (`ID`) VALUES ('1')"); $pdo->exec("INSERT INTO `OAUTH_CLIENTS` (`CLIENT_ID`, `CLIENT_SECRET`, `CLIENT_NAME`, `CLIENT_DESCRIPTION`, `CLIENT_WEBSITE`, `REDIRECT_URI`, `USR_UID`) VALUES -('x-pm-local-client', '179ad45c6ce2cb97cf1029e212046e81', 'PM Web Designer', 'ProcessMaker Web Designer App', 'www.processmaker.com', 'http://".$_SERVER["HTTP_HOST"].":".$_SERVER['SERVER_PORT']."/sys".config("sys_sys")."/en/neoclassic/oauth2/grant', '00000000000000000000000000000001');"); +('x-pm-local-client', '179ad45c6ce2cb97cf1029e212046e81', 'PM Web Designer', 'ProcessMaker Web Designer App', 'www.processmaker.com', 'http://".$_SERVER["HTTP_HOST"].":".$_SERVER['SERVER_PORT']."/sys".config("system.workspace")."/en/neoclassic/oauth2/grant', '00000000000000000000000000000001');"); $pdo->exec("INSERT INTO `OAUTH_ACCESS_TOKENS` (`ACCESS_TOKEN`, `CLIENT_ID`, `USER_ID`, `EXPIRES`, `SCOPE`) VALUES ('39704d17049f5aef45e884e7b769989269502f83', 'x-pm-local-client', '00000000000000000000000000000001', '2017-06-15 17:55:19', 'view_processes edit_processes *');"); } @@ -193,7 +193,7 @@ class WorkflowTestCase extends TestCase protected function getBaseUrl($url) { return (\G::is_https() ? "https://" : "http://"). - $GLOBALS["APP_HOST"].':'.$GLOBALS['SERVER_PORT']."/sys".config("sys_sys")."/". + $GLOBALS["APP_HOST"].':'.$GLOBALS['SERVER_PORT']."/sys".config("system.workspace")."/". SYS_LANG."/".SYS_SKIN."/".$url; } } diff --git a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/SkinsTest.php b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/SkinsTest.php index bc04e29bd..2e95aa342 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/SkinsTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/SkinsTest.php @@ -72,6 +72,6 @@ class SkinsTest extends \WorkflowTestCase $this->assertCount(4, $skins); $this->assertEquals($skins[2]['SKIN_FOLDER_ID'], 'test'); $this->assertEquals($skins[3]['SKIN_FOLDER_ID'], 'test2'); - $this->assertEquals($skins[3]['SKIN_WORKSPACE'], config("sys_sys")); + $this->assertEquals($skins[3]['SKIN_WORKSPACE'], config("system.workspace")); } } diff --git a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEventTest.php b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEventTest.php index b55aa3c9a..a4f025cad 100644 --- a/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEventTest.php +++ b/tests/unit/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEventTest.php @@ -284,7 +284,7 @@ class WebEntryEventTest extends \WorkflowTestCase $this->createWebEntryEvent( $processUid, $entryEvents, [ - 'WEE_URL' => $this->domain."/sys".config("sys_sys")."/".SYS_LANG."/".SYS_SKIN."/".$processUid."/custom.php", + 'WEE_URL' => $this->domain."/sys".config("system.workspace")."/".SYS_LANG."/".SYS_SKIN."/".$processUid."/custom.php", 'WE_TYPE' => "NOT-VALID-SINGLE", 'WE_CUSTOM_TITLE' => $this->customTitle, 'WE_AUTHENTICATION' => 'NOT-VALID-ANONYMOUS', @@ -373,7 +373,7 @@ class WebEntryEventTest extends \WorkflowTestCase $webEntryEventUid, $userUidUpdater, [ - 'WEE_URL' => $this->domain."/sys".config("sys_sys")."/".SYS_LANG."/".SYS_SKIN."/".$processUid."/custom.php", + 'WEE_URL' => $this->domain."/sys".config("system.workspace")."/".SYS_LANG."/".SYS_SKIN."/".$processUid."/custom.php", 'WE_TYPE' => "NOT-VALID-SINGLE", 'WE_CUSTOM_TITLE' => $this->customTitle, 'WE_AUTHENTICATION' => 'NOT-VALID-ANONYMOUS', @@ -671,7 +671,7 @@ class WebEntryEventTest extends \WorkflowTestCase private function getSimpleWebEntryUrl(\WebEntry $we) { return (\G::is_https() ? "https://" : "http://"). - $_SERVER["HTTP_HOST"]."/sys".config("sys_sys")."/". + $_SERVER["HTTP_HOST"]."/sys".config("system.workspace")."/". SYS_LANG."/".SYS_SKIN."/".$we->getProUid()."/".$we->getWeData(); } diff --git a/thirdparty/html2ps_pdf/config.inc.php b/thirdparty/html2ps_pdf/config.inc.php index bbed2fc5b..716dcb1e2 100644 --- a/thirdparty/html2ps_pdf/config.inc.php +++ b/thirdparty/html2ps_pdf/config.inc.php @@ -102,7 +102,7 @@ define('MAX_IMAGE_ROW_LEN',16); define('MAX_TRANSPARENT_IMAGE_ROW_LEN',16); define('CACHE_DIR', HTML2PS_DIR.'cache/'); -//define('OUTPUT_FILE_DIRECTORY', HTML2PS_DIR.'out/'.(defined('SYS_SYS') ? config("sys_sys") . '/' : '')); +//define('OUTPUT_FILE_DIRECTORY', HTML2PS_DIR.'out/'.(!empty(config("system.workspace")) ? config("system.workspace") . '/' : '')); define('OUTPUT_FILE_DIRECTORY', PATH_OUTPUT_FILE_DIRECTORY); define('FPDF_PATH', HTML2PS_DIR.'fpdf/'); diff --git a/thirdparty/pear/Log/file.php b/thirdparty/pear/Log/file.php index 63f308f06..1ff3873a2 100644 --- a/thirdparty/pear/Log/file.php +++ b/thirdparty/pear/Log/file.php @@ -284,9 +284,9 @@ class Log_file extends Log if ( !defined('PM_PID') ) { define ('PM_PID', rand(0,1000) ); } - if ( !defined('SYS_SYS') ) { + if (empty(config("system.workspace"))) { define ('SYS_SYS', '' ); - config(["sys_sys" => ""]); + config(["system.workspace" => ""]); } /* If a priority hasn't been specified, use the default value. */ if ($priority === null) { @@ -327,7 +327,7 @@ class Log_file extends Log $micro = date('H:i:s.') . sprintf("%04d", floor($usec * 10000 )); /* Build the string containing the complete message */ - $msg = sprintf ( "%s|%s|%s|%05d|%s|%s|%s|%s|%s\n", $micro,config("sys_sys"),$ip, $myPid, $message, $backTrace[3], $method, $uri, $request); + $msg = sprintf ( "%s|%s|%s|%05d|%s|%s|%s|%s|%s\n", $micro,config("system.workspace"),$ip, $myPid, $message, $backTrace[3], $method, $uri, $request); /* Build the string containing the complete log line. */ $line = $this->_format('%4$s', $micro,'',$msg ); diff --git a/workflow/engine/PmBootstrap.php b/workflow/engine/PmBootstrap.php index 1792c6cf5..527d6c9a9 100644 --- a/workflow/engine/PmBootstrap.php +++ b/workflow/engine/PmBootstrap.php @@ -239,11 +239,11 @@ class PmBootstrap extends Bootstrap public function initPropel($sys = '') { if (empty($sys)) { - if (! defined("SYS_SYS")) { + if (empty(config("system.workspace"))) { throw new Exception("Error: Undefined syemtem env. constant 'SYS_SYS'"); } - $sys = config("sys_sys"); + $sys = config("system.workspace"); } // setup propel definitions and logging diff --git a/workflow/engine/bin/cron_single.php b/workflow/engine/bin/cron_single.php index 2770e159a..284d4d6cb 100644 --- a/workflow/engine/bin/cron_single.php +++ b/workflow/engine/bin/cron_single.php @@ -132,13 +132,13 @@ try { if (is_dir(PATH_DB . $workspace) && file_exists(PATH_DB . $workspace . PATH_SEP . 'db.php')) { define('SYS_SYS', $workspace); - config(["sys_sys" => $workspace]); + config(["system.workspace" => $workspace]); include_once(PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths_installed.php'); include_once(PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php'); //PM Paths DATA - define('PATH_DATA_SITE', PATH_DATA . 'sites/' . config("sys_sys") . '/'); + define('PATH_DATA_SITE', PATH_DATA . 'sites/' . config("system.workspace") . '/'); define('PATH_DOCUMENT', PATH_DATA_SITE . 'files/'); define('PATH_DATA_MAILTEMPLATES', PATH_DATA_SITE . 'mailTemplates/'); define('PATH_DATA_PUBLIC', PATH_DATA_SITE . 'public/'); @@ -418,7 +418,7 @@ function executePlugins() } if ($handle = opendir($pathCronPlugins)) { - setExecutionMessage('Executing cron files in bin/plugins directory in Workspace: ' . config("sys_sys")); + setExecutionMessage('Executing cron files in bin/plugins directory in Workspace: ' . config("system.workspace")); while (false !== ($file = readdir($handle))) { if (strpos($file, '.php',1) && is_file($pathCronPlugins . $file)) { $filename = str_replace('.php' , '', $file); @@ -438,7 +438,7 @@ function executePlugins() // -> Execute functions if (!empty($cronFiles)) { - setExecutionMessage('Executing registered cron files for Workspace: ' . config("sys_sys")); + setExecutionMessage('Executing registered cron files for Workspace: ' . config("system.workspace")); foreach($cronFiles as $cronFile) { executeCustomCronFunction(PATH_PLUGINS . $cronFile->namespace . PATH_SEP . 'bin' . PATH_SEP . $cronFile->cronFile . '.php', $cronFile->cronFile); } diff --git a/workflow/engine/bin/reindex_solr.php b/workflow/engine/bin/reindex_solr.php index e35df1ca0..26452d178 100644 --- a/workflow/engine/bin/reindex_solr.php +++ b/workflow/engine/bin/reindex_solr.php @@ -128,7 +128,7 @@ print "PATH_DB: " . PATH_DB . "\n"; print "PATH_CORE: " . PATH_CORE . "\n"; // define the site name (instance name) -if (! defined ('SYS_SYS')) { +if (empty(config("system.workspace"))) { $sObject = $workspaceName; $sNow = ''; // $argv[2]; $sFilter = ''; @@ -144,12 +144,12 @@ if (! defined ('SYS_SYS')) { if (file_exists (PATH_DB . $sObject . PATH_SEP . 'db.php')) { define ('SYS_SYS', $sObject); - config(["sys_sys" => $sObject]); + config(["system.workspace" => $sObject]); // **************************************** // read initialize file require_once PATH_HOME . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'class.system.php'; - $config = System::getSystemConfiguration ('', '', config("sys_sys")); + $config = System::getSystemConfiguration ('', '', config("system.workspace")); define ('MEMCACHED_ENABLED', $config ['memcached']); define ('MEMCACHED_SERVER', $config ['memcached_server']); define ('TIME_ZONE', $config ['time_zone']); @@ -171,7 +171,7 @@ if (! defined ('SYS_SYS')) { include_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php'); // ***************** PM Paths DATA ************************** - define ('PATH_DATA_SITE', PATH_DATA . 'sites/' . config("sys_sys") . '/'); + define ('PATH_DATA_SITE', PATH_DATA . 'sites/' . config("system.workspace") . '/'); define ('PATH_DOCUMENT', PATH_DATA_SITE . 'files/'); define ('PATH_DATA_MAILTEMPLATES', PATH_DATA_SITE . 'mailTemplates/'); define ('PATH_DATA_PUBLIC', PATH_DATA_SITE . 'public/'); @@ -265,7 +265,7 @@ function processWorkspace() try { - if (($solrConf = System::solrEnv (config("sys_sys"))) !== false) { + if (($solrConf = System::solrEnv (config("system.workspace"))) !== false) { print "Solr Configuration file: " . PATH_DATA_SITE . "env.ini\n"; print "solr_enabled: " . $solrConf ['solr_enabled'] . "\n"; print "solr_host: " . $solrConf ['solr_host'] . "\n"; diff --git a/workflow/engine/bin/tasks/cliAddons.php b/workflow/engine/bin/tasks/cliAddons.php index fed5e5e74..e6da3d69a 100644 --- a/workflow/engine/bin/tasks/cliAddons.php +++ b/workflow/engine/bin/tasks/cliAddons.php @@ -46,12 +46,12 @@ function run_addon_core_install($args) $storeId = $args[1]; $addonName = $args[2]; - if (!defined("SYS_SYS")) { + if (empty(config("system.workspace"))) { define("SYS_SYS", $workspace); - config(["sys_sys" => $workspace]); + config(["system.workspace" => $workspace]); } if (!defined("PATH_DATA_SITE")) { - define("PATH_DATA_SITE", PATH_DATA . "sites/" . config("sys_sys") . "/"); + define("PATH_DATA_SITE", PATH_DATA . "sites/" . config("system.workspace") . "/"); } if (!defined("DB_ADAPTER")) { define("DB_ADAPTER", $args[3]); @@ -103,12 +103,12 @@ function change_hash($command, $opts) $response = new stdclass(); $response->workspace = $workspace; $response->hash = $hash; - if (!defined("SYS_SYS")) { + if (empty(config("system.workspace"))) { define("SYS_SYS", $workspace->name); - config(["sys_sys" => $workspace->name]); + config(["system.workspace" => $workspace->name]); } if (!defined("PATH_DATA_SITE")) { - define("PATH_DATA_SITE", PATH_DATA . "sites/" . config("sys_sys") . "/"); + define("PATH_DATA_SITE", PATH_DATA . "sites/" . config("system.workspace") . "/"); } $_SESSION['__sw__'] = ''; if (!$workspace->changeHashPassword($workspace->name, $response)) { diff --git a/workflow/engine/bin/tasks/cliUpgrade.php b/workflow/engine/bin/tasks/cliUpgrade.php index 4a14d3424..b18e798e9 100644 --- a/workflow/engine/bin/tasks/cliUpgrade.php +++ b/workflow/engine/bin/tasks/cliUpgrade.php @@ -132,13 +132,13 @@ function run_upgrade($command, $args) $flagUpdateXml = !array_key_exists('noxml', $args); foreach ($workspaces as $index => $workspace) { - if (!defined("SYS_SYS")) { + if (empty(config("system.workspace"))) { define("SYS_SYS", $workspace->name); - config(["sys_sys" => $workspace->name]); + config(["system.workspace" => $workspace->name]); } if (!defined("PATH_DATA_SITE")) { - define("PATH_DATA_SITE", PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP); + define("PATH_DATA_SITE", PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP); } if(!defined('DB_ADAPTER')) { diff --git a/workflow/engine/bin/tasks/cliWorkspaces.php b/workflow/engine/bin/tasks/cliWorkspaces.php index b1a182ddf..7983ec773 100644 --- a/workflow/engine/bin/tasks/cliWorkspaces.php +++ b/workflow/engine/bin/tasks/cliWorkspaces.php @@ -358,13 +358,13 @@ function run_workspace_upgrade($args, $opts) foreach ($workspaces as $workspace) { try { - if (!defined("SYS_SYS")) { + if (empty(config("system.workspace"))) { define("SYS_SYS", $workspace->name); - config(["sys_sys" => $workspace->name]); + config(["system.workspace" => $workspace->name]); } if (!defined("PATH_DATA_SITE")) { - define("PATH_DATA_SITE", PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP); + define("PATH_DATA_SITE", PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP); } $workspace->upgrade($buildCacheView, $workspace->name, false, $lang, ['updateXml' => $flagUpdateXml, 'updateMafe' => $first]); diff --git a/workflow/engine/bin/verify_solr.php b/workflow/engine/bin/verify_solr.php index 30d79a6e4..043a8a3e8 100644 --- a/workflow/engine/bin/verify_solr.php +++ b/workflow/engine/bin/verify_solr.php @@ -98,7 +98,7 @@ print "PATH_DB: " . PATH_DB . "\n"; print "PATH_CORE: " . PATH_CORE . "\n"; // define the site name (instance name) -if (! defined ('SYS_SYS')) { +if (empty(config("system.workspace"))) { $sObject = $workspaceName; $sNow = ''; // $argv[2]; /* @@ -115,12 +115,12 @@ if (! defined ('SYS_SYS')) { if (file_exists (PATH_DB . $sObject . PATH_SEP . 'db.php')) { define ('SYS_SYS', $sObject); - config(["sys_sys" => $sObject]); + config(["system.workspace" => $sObject]); // **************************************** // read initialize file require_once PATH_HOME . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'class.system.php'; - $config = System::getSystemConfiguration ('', '', config("sys_sys")); + $config = System::getSystemConfiguration ('', '', config("system.workspace")); define ('MEMCACHED_ENABLED', $config ['memcached']); define ('MEMCACHED_SERVER', $config ['memcached_server']); define ('TIME_ZONE', $config ['time_zone']); @@ -143,7 +143,7 @@ if (! defined ('SYS_SYS')) { print "MEMCACHED_SERVER: " . $MEMCACHED_SERVER . "\n"; // ***************** PM Paths DATA ************************** - define ('PATH_DATA_SITE', PATH_DATA . 'sites/' . config("sys_sys") . '/'); + define ('PATH_DATA_SITE', PATH_DATA . 'sites/' . config("system.workspace") . '/'); define ('PATH_DOCUMENT', PATH_DATA_SITE . 'files/'); define ('PATH_DATA_MAILTEMPLATES', PATH_DATA_SITE . 'mailTemplates/'); define ('PATH_DATA_PUBLIC', PATH_DATA_SITE . 'public/'); @@ -338,7 +338,7 @@ function displayMissingCases($aAppUidsDB, $aAppUidsSolr) function getListUids($usrUid, $action) { - if (($solrConf = System::solrEnv (config("sys_sys"))) !== false) { + if (($solrConf = System::solrEnv (config("system.workspace"))) !== false) { print "Solr Configuration file: " . PATH_DATA_SITE . "env.ini\n"; print "solr_enabled: " . $solrConf ['solr_enabled'] . "\n"; diff --git a/workflow/engine/classes/ActionsByEmailCoreClass.php b/workflow/engine/classes/ActionsByEmailCoreClass.php index 27e2fa1fe..8fec488f0 100644 --- a/workflow/engine/classes/ActionsByEmailCoreClass.php +++ b/workflow/engine/classes/ActionsByEmailCoreClass.php @@ -160,7 +160,7 @@ class ActionsByEmailCoreClass extends PMPlugin if (!empty($envPort) && strpos($envHost, $envPort) === false) { $envHost = $envHost . $envPort; } - $link = (G::is_https() || $envProtocol ? 'https://' : 'http://') . $envHost . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . $envSkin . '/services/ActionsByEmail'; + $link = (G::is_https() || $envProtocol ? 'https://' : 'http://') . $envHost . '/sys' . config("system.workspace") . '/' . SYS_LANG . '/' . $envSkin . '/services/ActionsByEmail'; switch ($configuration['ABE_TYPE']) { case 'CUSTOM': diff --git a/workflow/engine/classes/Applications.php b/workflow/engine/classes/Applications.php index 0d7f2b4d6..7479c55e6 100644 --- a/workflow/engine/classes/Applications.php +++ b/workflow/engine/classes/Applications.php @@ -705,7 +705,7 @@ class Applications $tableName = implode( '', $newTableName ); // so the pm table class can be invoqued from the pm table model clases if (! class_exists( $tableName )) { - require_once (PATH_DB . config("sys_sys") . PATH_SEP . "classes" . PATH_SEP . $tableName . ".php"); + require_once (PATH_DB . config("system.workspace") . PATH_SEP . "classes" . PATH_SEP . $tableName . ".php"); } } $totalCount = AppCacheViewPeer::doCount($CriteriaCount, $distinct); diff --git a/workflow/engine/classes/Cases.php b/workflow/engine/classes/Cases.php index 5f1b05de2..9eccb3e89 100644 --- a/workflow/engine/classes/Cases.php +++ b/workflow/engine/classes/Cases.php @@ -1068,7 +1068,7 @@ class Cases $oDerivation->verifyIsCaseChild($sAppUid); } } catch (Exception $e) { - Bootstrap::registerMonolog('DeleteCases', 200, 'Error in sub-process when trying to route a child case related to the case', ['application_uid' => $sAppUid, 'error' => $e->getMessage()], config("sys_sys"), 'processmaker.log'); + Bootstrap::registerMonolog('DeleteCases', 200, 'Error in sub-process when trying to route a child case related to the case', ['application_uid' => $sAppUid, 'error' => $e->getMessage()], config("system.workspace"), 'processmaker.log'); } //Delete the registries in the table SUB_APPLICATION @@ -2211,7 +2211,7 @@ class Cases "delIndex" => $iDelIndex, "appInitDate" => $Fields['APP_INIT_DATE'] ]; - Bootstrap::registerMonolog('CreateCase', 200, "Create case", $data, config("sys_sys"), 'processmaker.log'); + Bootstrap::registerMonolog('CreateCase', 200, "Create case", $data, config("system.workspace"), 'processmaker.log'); //call plugin if (class_exists('folderData')) { @@ -3375,7 +3375,7 @@ class Cases $oPMScript->setFields($aFields); /*----------------------------------********---------------------------------*/ - $cs = new CodeScanner(config("sys_sys")); + $cs = new CodeScanner(config("system.workspace")); $strFoundDisabledCode = ""; /*----------------------------------********---------------------------------*/ diff --git a/workflow/engine/classes/ConsolidatedCases.php b/workflow/engine/classes/ConsolidatedCases.php index eba5139ba..304c340d1 100644 --- a/workflow/engine/classes/ConsolidatedCases.php +++ b/workflow/engine/classes/ConsolidatedCases.php @@ -146,7 +146,7 @@ class ConsolidatedCases } $sClassName = $TableName; - $sPath = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; + $sPath = PATH_DB . config("system.workspace") . PATH_SEP . 'classes' . PATH_SEP; @unlink($sPath . $sClassName . '.php'); @unlink($sPath . $sClassName . 'Peer.php'); diff --git a/workflow/engine/classes/Derivation.php b/workflow/engine/classes/Derivation.php index 141ea89c1..45e980a42 100644 --- a/workflow/engine/classes/Derivation.php +++ b/workflow/engine/classes/Derivation.php @@ -856,7 +856,7 @@ class Derivation */ function derivate(array $currentDelegation, array $nextDelegations, $removeList = true) { - $this->sysSys = (defined("SYS_SYS"))? config("sys_sys") : "Undefined"; + $this->sysSys = (!empty(config("system.workspace")))? config("system.workspace") : "Undefined"; $this->context = Bootstrap::getDefaultContextLog(); $aContext = $this->context; $this->removeList = $removeList; diff --git a/workflow/engine/classes/EnterpriseClass.php b/workflow/engine/classes/EnterpriseClass.php index 17f25c6e3..e47b22b44 100644 --- a/workflow/engine/classes/EnterpriseClass.php +++ b/workflow/engine/classes/EnterpriseClass.php @@ -101,11 +101,11 @@ class EnterpriseClass extends PMPlugin { $oServerConf = &ServerConf::getSingleton(); $infoLicense =$oServerConf->getProperty('LICENSE_INFO'); - if (isset($infoLicense[config("sys_sys")]['LIMIT_USERS'])) { + if (isset($infoLicense[config("system.workspace")]['LIMIT_USERS'])) { $criteria = new Criteria('workflow'); $criteria->add(UsersPeer::USR_STATUS, 'CLOSED', Criteria::NOT_EQUAL); $count = UsersPeer::doCount($criteria); - if ($count >= $infoLicense[config("sys_sys")]['LIMIT_USERS'] ) { + if ($count >= $infoLicense[config("system.workspace")]['LIMIT_USERS'] ) { throw new Exception("You can\'t add more users to the System, this reach the limit of allowed users by license that it has installed now"); } } diff --git a/workflow/engine/classes/IndicatorsCalculator.php b/workflow/engine/classes/IndicatorsCalculator.php index 4f4732ff5..ad3bdb05b 100644 --- a/workflow/engine/classes/IndicatorsCalculator.php +++ b/workflow/engine/classes/IndicatorsCalculator.php @@ -650,7 +650,7 @@ class IndicatorsCalculator } private function pdoConnection() { - $currentWS = defined('SYS_SYS') ? config("sys_sys") : 'Wokspace Undefined'; + $currentWS = !empty(config("system.workspace")) ? config("system.workspace") : 'Wokspace Undefined'; $workSpace = new WorkspaceTools($currentWS); $arrayHost = explode(':', $workSpace->dbHost); $host = "host=".$arrayHost[0]; diff --git a/workflow/engine/classes/LdapAdvanced.php b/workflow/engine/classes/LdapAdvanced.php index fee97b462..5b74ed0b6 100644 --- a/workflow/engine/classes/LdapAdvanced.php +++ b/workflow/engine/classes/LdapAdvanced.php @@ -470,7 +470,7 @@ class LdapAdvanced } //log format: date hour ipaddress workspace ldapErrorNr - fwrite($fpt, sprintf("%s %s %s %s %s \n", date("Y-m-d H:i:s"), getenv("REMOTE_ADDR"), config("sys_sys"), $ldapErrorNr, $text)); + fwrite($fpt, sprintf("%s %s %s %s %s \n", date("Y-m-d H:i:s"), getenv("REMOTE_ADDR"), config("system.workspace"), $ldapErrorNr, $text)); fclose($fpt); } else { error_log("file $logFile is not writable "); diff --git a/workflow/engine/classes/PMLicensedFeatures.php b/workflow/engine/classes/PMLicensedFeatures.php index 809346c6f..2b6cd7425 100644 --- a/workflow/engine/classes/PMLicensedFeatures.php +++ b/workflow/engine/classes/PMLicensedFeatures.php @@ -337,7 +337,7 @@ class PMLicensedFeatures /*----------------------------------********---------------------------------*/ public function verifyfeature ($featureName) { - $cached = Cache::get(PmLicenseManager::CACHE_KEY . '.' . config("sys_sys"), []); + $cached = Cache::get(PmLicenseManager::CACHE_KEY . '.' . config("system.workspace"), []); if (isset($cached[$featureName])) { return $cached[$featureName]; } @@ -360,7 +360,7 @@ class PMLicensedFeatures $this->featuresDetails[$value[0]]->enabled = $enable; $cached[$featureName] = $enable; - Cache::put(PmLicenseManager::CACHE_KEY . '.' . config("sys_sys"), $cached, Carbon::now()->addDay(1)); + Cache::put(PmLicenseManager::CACHE_KEY . '.' . config("system.workspace"), $cached, Carbon::now()->addDay(1)); return $enable; } diff --git a/workflow/engine/classes/PMPluginRegistry.php b/workflow/engine/classes/PMPluginRegistry.php index 8e88a9d94..13e6deae8 100644 --- a/workflow/engine/classes/PMPluginRegistry.php +++ b/workflow/engine/classes/PMPluginRegistry.php @@ -1103,7 +1103,7 @@ class PMPluginRegistry try { $iPlugins = 0; $oServerConf = & ServerConf::getSingleton(); - $oServerConf->addPlugin( config("sys_sys"), $this->_aPluginDetails ); + $oServerConf->addPlugin( config("system.workspace"), $this->_aPluginDetails ); foreach ($this->_aPluginDetails as $namespace => $detail) { if (isset( $detail->enabled ) && $detail->enabled) { if (! empty( $detail->sFilename ) && file_exists( $detail->sFilename )) { diff --git a/workflow/engine/classes/PmDrive.php b/workflow/engine/classes/PmDrive.php index ce45ba415..16fe5c179 100644 --- a/workflow/engine/classes/PmDrive.php +++ b/workflow/engine/classes/PmDrive.php @@ -31,7 +31,7 @@ class PmDrive extends PmGoogleApi $this->folderIdPMDrive = empty($dataUser['USR_PMDRIVE_FOLDER_UID']) ? '' : $dataUser['USR_PMDRIVE_FOLDER_UID']; $conf = $this->getConfigGmail(); - $this->folderNamePMDrive = empty($conf->aConfig['folderNamePMDrive']) ? 'PMDrive (' . config("sys_sys") . ')' : $conf->aConfig['folderNamePMDrive']; + $this->folderNamePMDrive = empty($conf->aConfig['folderNamePMDrive']) ? 'PMDrive (' . config("system.workspace") . ')' : $conf->aConfig['folderNamePMDrive']; if ($this->folderIdPMDrive == '') { $folderid = $this->createFolder($this->folderNamePMDrive); diff --git a/workflow/engine/classes/PmDynaform.php b/workflow/engine/classes/PmDynaform.php index f139af765..3ad5a2cf0 100644 --- a/workflow/engine/classes/PmDynaform.php +++ b/workflow/engine/classes/PmDynaform.php @@ -35,7 +35,7 @@ class PmDynaform public function __construct($fields = array()) { - $this->sysSys = (defined("SYS_SYS")) ? config("sys_sys") : "Undefined"; + $this->sysSys = (!empty(config("system.workspace"))) ? config("system.workspace") : "Undefined"; $this->context = \Bootstrap::getDefaultContextLog(); $this->dataSources = array("database", "dataVariable"); $this->pathRTLCss = '/lib/pmdynaform/build/css/PMDynaform-rtl.css'; @@ -1007,7 +1007,7 @@ class PmDynaform var app_uid = \"" . $this->fields["APP_UID"] . "\"; var prj_uid = \"" . $this->fields["PRO_UID"] . "\"; var step_mode = \"\"; - var workspace = \"" . config("sys_sys") . "\"; + var workspace = \"" . config("system.workspace") . "\"; var credentials = " . G::json_encode($this->credentials) . "; var filePost = \"\"; var fieldsRequired = null; @@ -1068,7 +1068,7 @@ class PmDynaform "var app_uid = '" . $this->fields["APP_UID"] . "';\n" . "var prj_uid = '" . $this->fields["PRO_UID"] . "';\n" . "var step_mode = null;\n" . - "var workspace = '" . config("sys_sys") . "';\n" . + "var workspace = '" . config("system.workspace") . "';\n" . "var credentials = " . G::json_encode($this->credentials) . ";\n" . "var filePost = null;\n" . "var fieldsRequired = null;\n" . @@ -1147,7 +1147,7 @@ class PmDynaform "var app_uid = '" . $this->fields["APP_UID"] . "';\n" . "var prj_uid = '" . $this->fields["PRO_UID"] . "';\n" . "var step_mode = '" . $this->fields["STEP_MODE"] . "';\n" . - "var workspace = '" . config("sys_sys") . "';\n" . + "var workspace = '" . config("system.workspace") . "';\n" . "var credentials = " . G::json_encode($this->credentials) . ";\n" . "var filePost = null;\n" . "var fieldsRequired = null;\n" . @@ -1204,7 +1204,7 @@ class PmDynaform var app_uid = \"" . $this->fields["APP_UID"] . "\"; var prj_uid = \"" . $this->fields["PRO_UID"] . "\"; var step_mode = null; - var workspace = \"" . config("sys_sys") . "\"; + var workspace = \"" . config("system.workspace") . "\"; var credentials = " . G::json_encode($this->credentials) . "; var filePost = \"cases_SaveDataSupervisor?UID=" . $this->fields["CURRENT_DYNAFORM"] . "\"; var fieldsRequired = null; @@ -1248,7 +1248,7 @@ class PmDynaform "var app_uid = null;\n" . "var prj_uid = '" . $this->record["PRO_UID"] . "';\n" . "var step_mode = null;\n" . - "var workspace = '" . config("sys_sys") . "';\n" . + "var workspace = '" . config("system.workspace") . "';\n" . "var credentials = " . G::json_encode($this->credentials) . ";\n" . "var filePost = '" . $filename . "';\n" . "var fieldsRequired = " . G::json_encode(array()) . ";\n" . @@ -1290,7 +1290,7 @@ class PmDynaform "var app_uid = '" . G::decrypt($record['APP_UID'], URL_KEY) . "';\n" . "var prj_uid = '" . $this->record["PRO_UID"] . "';\n" . "var step_mode = null;\n" . - "var workspace = '" . config("sys_sys") . "';\n" . + "var workspace = '" . config("system.workspace") . "';\n" . "var credentials = " . G::json_encode($this->credentials) . ";\n" . "var filePost = '" . $filename . "';\n" . "var fieldsRequired = " . G::json_encode(array()) . ";\n" . @@ -1354,7 +1354,7 @@ class PmDynaform "var app_uid = null;\n" . "var prj_uid = '" . $this->record["PRO_UID"] . "';\n" . "var step_mode = null;\n" . - "var workspace = '" . config("sys_sys") . "';\n" . + "var workspace = '" . config("system.workspace") . "';\n" . "var credentials = " . G::json_encode($this->credentials) . ";\n" . "var fieldsRequired = " . G::json_encode(array()) . ";\n" . "var triggerDebug = null;\n" . @@ -2100,7 +2100,7 @@ class PmDynaform 400, 'JSON encoded string error ' . $jsonLastError . ': ' . $jsonLastErrorMsg, ['token' => $token, 'projectUid' => $this->record['PRO_UID'], 'dynaFormUid' => $this->record['DYN_UID']], - config("sys_sys"), + config("system.workspace"), 'processmaker.log' ); } diff --git a/workflow/engine/classes/PmLicenseManager.php b/workflow/engine/classes/PmLicenseManager.php index a36333588..9e09571a0 100644 --- a/workflow/engine/classes/PmLicenseManager.php +++ b/workflow/engine/classes/PmLicenseManager.php @@ -26,11 +26,11 @@ class PmLicenseManager $activeLicenseSetting = $oServerConf->getProperty('ACTIVE_LICENSE'); - if ((isset($activeLicenseSetting[config("sys_sys")])) && (file_exists($activeLicenseSetting[config("sys_sys")]))) { - $licenseFile = $activeLicenseSetting[config("sys_sys")]; + if ((isset($activeLicenseSetting[config("system.workspace")])) && (file_exists($activeLicenseSetting[config("system.workspace")]))) { + $licenseFile = $activeLicenseSetting[config("system.workspace")]; } else { $activeLicense = $this->getActiveLicense(); - $oServerConf->setProperty('ACTIVE_LICENSE', [config("sys_sys") => $activeLicense['LICENSE_PATH']]); + $oServerConf->setProperty('ACTIVE_LICENSE', [config("system.workspace") => $activeLicense['LICENSE_PATH']]); $licenseFile = $activeLicense['LICENSE_PATH']; } @@ -77,7 +77,7 @@ class PmLicenseManager $this->supportEndDate = date("Y-m-d H:i:s", strtotime($this->supportEndDate)); $conf = new Configurations(); - if (defined('SYS_SYS') && $conf->exists("ENVIRONMENT_SETTINGS")) { + if (!empty(config("system.workspace")) && $conf->exists("ENVIRONMENT_SETTINGS")) { $this->supportStartDate = $conf->getSystemDate($this->supportStartDate); $this->supportEndDate = $conf->getSystemDate($this->supportEndDate); } else { @@ -103,14 +103,14 @@ class PmLicenseManager $licInfoA = $oServerConf->getProperty('LICENSE_INFO'); // The HUMAN attribute varies according to the timezone configured in the server, therefore it does not need // to be considered in the comparison if the value was changed or not, it is only comparing with te "timestamp" - if (isset($licInfoA[config("sys_sys")]['date']['HUMAN'])) { - unset($licInfoA[config("sys_sys")]['date']['HUMAN']); + if (isset($licInfoA[config("system.workspace")]['date']['HUMAN'])) { + unset($licInfoA[config("system.workspace")]['date']['HUMAN']); } } else { $licInfoA = []; } - if (empty($licInfoA[config("sys_sys")]) || ($licInfoA[config("sys_sys")] != $resultsRegister)) { - $licInfoA[config("sys_sys")] = $resultsRegister; + if (empty($licInfoA[config("system.workspace")]) || ($licInfoA[config("system.workspace")] != $resultsRegister)) { + $licInfoA[config("system.workspace")] = $resultsRegister; $oServerConf->setProperty('LICENSE_INFO', $licInfoA); } } @@ -337,11 +337,11 @@ class PmLicenseManager } if (class_exists('pmTrialPlugin')) { - $linkText = $linkText . " "; + $linkText = $linkText . " "; } if (isset($_SESSION["__ENTERPRISE_SYSTEM_UPDATE__"]) && $_SESSION["__ENTERPRISE_SYSTEM_UPDATE__"] == 1) { - $aOnclick = "onclick=\"this.href='" . EnterpriseUtils::getUrlServerName() . "/sys" . config("sys_sys") . "/" . SYS_LANG . "/" . SYS_SKIN . "/setup/main?s=PMENTERPRISE';\""; + $aOnclick = "onclick=\"this.href='" . EnterpriseUtils::getUrlServerName() . "/sys" . config("system.workspace") . "/" . SYS_LANG . "/" . SYS_SKIN . "/setup/main?s=PMENTERPRISE';\""; if (EnterpriseUtils::skinIsUx() == 1) { $aOnclick = "onclick=\"Ext.ComponentMgr.get('mainTabPanel').setActiveTab('pm-option-setup'); Ext.ComponentMgr.get('pm-option-setup').setLocation(Ext.ComponentMgr.get('pm-option-setup').defaultSrc + 's=PMENTERPRISE', true); return (false);\""; } @@ -385,7 +385,7 @@ class PmLicenseManager } else { $oServerConf = &ServerConf::getSingleton(); - $oServerConf->setProperty('ACTIVE_LICENSE', [config("sys_sys") => $path]); + $oServerConf->setProperty('ACTIVE_LICENSE', [config("system.workspace") => $path]); $this->saveDataLicense($results, $path, $redirect); if ($redirect) { G::Header('location: ../enterprise/addonsStore'); @@ -482,7 +482,7 @@ class PmLicenseManager $tr->setLicenseType($LicenseType); $res = $tr->save(); - Cache::forget(PmLicenseManager::CACHE_KEY . '.' . config("sys_sys")); + Cache::forget(PmLicenseManager::CACHE_KEY . '.' . config("system.workspace")); } catch (Exception $e) { G::pr($e); } diff --git a/workflow/engine/classes/PmTable.php b/workflow/engine/classes/PmTable.php index dd4a36e0b..8101ceac2 100644 --- a/workflow/engine/classes/PmTable.php +++ b/workflow/engine/classes/PmTable.php @@ -212,7 +212,7 @@ class PmTable } $this->schemaFilename = 'schema.xml'; - $this->baseDir = PATH_DB . config("sys_sys") . PATH_SEP; + $this->baseDir = PATH_DB . config("system.workspace") . PATH_SEP; $this->targetDir = $this->baseDir . 'pmt-propel' . PATH_SEP . $this->dataSource . PATH_SEP; $this->configDir = $this->targetDir . 'config' . PATH_SEP; $this->dataDir = $this->targetDir . 'data' . PATH_SEP; diff --git a/workflow/engine/classes/ProcessMap.php b/workflow/engine/classes/ProcessMap.php index db3cafed0..727c3aa74 100644 --- a/workflow/engine/classes/ProcessMap.php +++ b/workflow/engine/classes/ProcessMap.php @@ -2755,7 +2755,7 @@ class ProcessMap $http = 'http://'; } - $link = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $sProcessUID . '/'; + $link = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("system.workspace") . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $sProcessUID . '/'; $row = array(); $c = 0; @@ -2767,8 +2767,8 @@ class ProcessMap $TaskFields['TAS_ASSIGN_TYPE'] = ''; $row[] = array('W_TITLE' => '', 'W_DELETE' => '', 'TAS_ASSIGN_TYPE' => $TaskFields['TAS_ASSIGN_TYPE'] ); - if (is_dir(PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP . "public" . PATH_SEP . $sProcessUID)) { - $dir = opendir(PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP . "public" . PATH_SEP . $sProcessUID); + if (is_dir(PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP . "public" . PATH_SEP . $sProcessUID)) { + $dir = opendir(PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP . "public" . PATH_SEP . $sProcessUID); while ($archivo = readdir($dir)) { //print $archivo." ****
"; if ($archivo != '.') { @@ -3115,7 +3115,7 @@ class ProcessMap public function listNoProcessesUser($sProcessUID) { - $memcache = & PMmemcached::getSingleton(config("sys_sys")); + $memcache = & PMmemcached::getSingleton(config("system.workspace")); $oCriteria = new Criteria('workflow'); $oCriteria->addSelectColumn(ProcessUserPeer::USR_UID); @@ -4777,7 +4777,7 @@ class ProcessMap $http = 'http://'; } - $link = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $sProcessUID . '/'; + $link = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("system.workspace") . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $sProcessUID . '/'; $row = array(); $c = 0; @@ -4790,8 +4790,8 @@ class ProcessMap //$row [] = array ('W_TITLE' => '', 'W_DELETE' => '', 'TAS_ASSIGN_TYPE' => $TaskFields ['TAS_ASSIGN_TYPE'] ); - if (is_dir(PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP . "public" . PATH_SEP . $sProcessUID)) { - $dir = opendir(PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP . "public" . PATH_SEP . $sProcessUID); + if (is_dir(PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP . "public" . PATH_SEP . $sProcessUID)) { + $dir = opendir(PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP . "public" . PATH_SEP . $sProcessUID); $dynTitle = str_replace(' ', '_', str_replace('/', '_', $dynTitle)); $arlink = $link . $dynTitle . '.php'; //$arlink = "" . $alink . ""; @@ -5812,7 +5812,7 @@ class ProcessMap public function listExtNoProcessesUser($sProcessUID) { - $memcache = & PMmemcached::getSingleton(config("sys_sys")); + $memcache = & PMmemcached::getSingleton(config("system.workspace")); $oCriteria = new Criteria('workflow'); $oCriteria->addSelectColumn(ProcessUserPeer::USR_UID); diff --git a/workflow/engine/classes/Processes.php b/workflow/engine/classes/Processes.php index 68adc605e..3ad46b442 100644 --- a/workflow/engine/classes/Processes.php +++ b/workflow/engine/classes/Processes.php @@ -4131,7 +4131,7 @@ class Processes try { $result = $scriptTask->create($processUid, $record); } catch (Exception $e) { - Bootstrap::registerMonolog('DataError', 400, $e->getMessage(), $record, config("sys_sys"), 'processmaker.log'); + Bootstrap::registerMonolog('DataError', 400, $e->getMessage(), $record, config("system.workspace"), 'processmaker.log'); } } } catch (Exception $e) { @@ -4499,7 +4499,7 @@ class Processes $proTitle = (substr(G::inflect($data->process['PRO_TITLE']), 0, 245)); $proTitle = preg_replace("/[^A-Za-z0-9_]/", "", $proTitle); //Calculating the maximum length of file name - $pathLength = strlen(PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP); + $pathLength = strlen(PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP); $length = strlen($proTitle) + $pathLength; $limit = 200; if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { @@ -4578,7 +4578,7 @@ class Processes // for mailtemplates files - $MAILS_ROOT_PATH = PATH_DATA . 'sites' . PATH_SEP . config("sys_sys") . PATH_SEP . 'mailTemplates' . PATH_SEP . $data->process['PRO_UID']; + $MAILS_ROOT_PATH = PATH_DATA . 'sites' . PATH_SEP . config("system.workspace") . PATH_SEP . 'mailTemplates' . PATH_SEP . $data->process['PRO_UID']; $isMailTempSent = false; $isPublicSent = false; @@ -4615,7 +4615,7 @@ class Processes } // for public files - $PUBLIC_ROOT_PATH = PATH_DATA . 'sites' . PATH_SEP . config("sys_sys") . PATH_SEP . 'public' . PATH_SEP . $data->process['PRO_UID']; + $PUBLIC_ROOT_PATH = PATH_DATA . 'sites' . PATH_SEP . config("system.workspace") . PATH_SEP . 'public' . PATH_SEP . $data->process['PRO_UID']; //Get WebEntry file names $arrayWebEntryFile = array(); @@ -4671,7 +4671,7 @@ class Processes /* // for public files - $PUBLIC_ROOT_PATH = PATH_DATA.'sites'.PATH_SEP.config("sys_sys").PATH_SEP.'public'.PATH_SEP.$data->process['PRO_UID']; + $PUBLIC_ROOT_PATH = PATH_DATA.'sites'.PATH_SEP.config("system.workspace").PATH_SEP.'public'.PATH_SEP.$data->process['PRO_UID']; //if this process have any mailfile if ( is_dir( $PUBLIC_ROOT_PATH ) ) { //get mail files list from this directory @@ -5067,7 +5067,7 @@ class Processes $context['url'] = SYS_CURRENT_URI . '?' . SYS_CURRENT_PARMS; } $context['usrUid'] = isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : ''; - $sysSys = defined("SYS_SYS") ? config("sys_sys") : "Undefined"; + $sysSys = !empty(config("system.workspace")) ? config("system.workspace") : "Undefined"; $message = 'The imported template has a number of byes different than the original template, please verify if the file \'' . $newFileName . '\' is correct.'; $level = 400; Bootstrap::registerMonolog($channel, $level, $message, $context, $sysSys, 'processmaker.log'); @@ -6079,7 +6079,7 @@ class Processes } //Set variables - $cs = new CodeScanner((!is_null($workspaceName))? $workspaceName : config("sys_sys")); + $cs = new CodeScanner((!is_null($workspaceName))? $workspaceName : config("system.workspace")); $delimiter = DBAdapter::getStringDelimiter(); diff --git a/workflow/engine/classes/ReportTables.php b/workflow/engine/classes/ReportTables.php index fecd0ba6e..528f58197 100644 --- a/workflow/engine/classes/ReportTables.php +++ b/workflow/engine/classes/ReportTables.php @@ -605,7 +605,7 @@ class ReportTables try { $rs = $stmt->executeQuery($sQuery); } catch (Exception $e) { - Bootstrap::registerMonolog('sqlExecution', 400, 'Sql Execution', ['sql' => $sQuery,'error' => $e->getMessage()], config("sys_sys"), 'processmaker.log'); + Bootstrap::registerMonolog('sqlExecution', 400, 'Sql Execution', ['sql' => $sQuery,'error' => $e->getMessage()], config("system.workspace"), 'processmaker.log'); } } @@ -644,7 +644,7 @@ class ReportTables try { $rs = $stmt->executeQuery($sQuery); } catch (Exception $e) { - Bootstrap::registerMonolog('sqlExecution', 400, 'Sql Execution', ['sql' => $sQuery,'error' => $e->getMessage()], config("sys_sys"), 'processmaker.log'); + Bootstrap::registerMonolog('sqlExecution', 400, 'Sql Execution', ['sql' => $sQuery,'error' => $e->getMessage()], config("system.workspace"), 'processmaker.log'); } } } else { diff --git a/workflow/engine/classes/ServerConf.php b/workflow/engine/classes/ServerConf.php index 166527f48..ad65c9699 100644 --- a/workflow/engine/classes/ServerConf.php +++ b/workflow/engine/classes/ServerConf.php @@ -152,12 +152,12 @@ class ServerConf public function sucessfulLogin() { $this->logins++; - if (isset($this->workspaces[config("sys_sys")]) && isset($this->workspaces[config("sys_sys")]['WSP_LOGINS'])) { - $this->workspaces[config("sys_sys")]['WSP_LOGINS']++; + if (isset($this->workspaces[config("system.workspace")]) && isset($this->workspaces[config("system.workspace")]['WSP_LOGINS'])) { + $this->workspaces[config("system.workspace")]['WSP_LOGINS']++; } - if (isset($this->workspaces[config("sys_sys")]) && !isset($this->workspaces[config("sys_sys")]['WSP_LOGINS'])) { - $this->workspaces[config("sys_sys")]['WSP_LOGINS'] = 1; + if (isset($this->workspaces[config("system.workspace")]) && !isset($this->workspaces[config("system.workspace")]['WSP_LOGINS'])) { + $this->workspaces[config("system.workspace")]['WSP_LOGINS'] = 1; } $this->saveSingleton(); diff --git a/workflow/engine/classes/Upgrade.php b/workflow/engine/classes/Upgrade.php index c65ef8937..67fa51dcf 100644 --- a/workflow/engine/classes/Upgrade.php +++ b/workflow/engine/classes/Upgrade.php @@ -100,7 +100,7 @@ class Upgrade try { $num += 1; printf("Upgrading workspaces ($num/$count): {$workspace->name}\n"); - $workspace->upgrade(false, config("sys_sys"), false, 'en', ['updateXml' => $first, 'updateMafe' => $first]); + $workspace->upgrade(false, config("system.workspace"), false, 'en', ['updateXml' => $first, 'updateMafe' => $first]); $workspace->close(); $first = false; } catch (Exception $e) { diff --git a/workflow/engine/classes/WorkspaceTools.php b/workflow/engine/classes/WorkspaceTools.php index f5dd94e74..849c22241 100644 --- a/workflow/engine/classes/WorkspaceTools.php +++ b/workflow/engine/classes/WorkspaceTools.php @@ -102,7 +102,7 @@ class WorkspaceTools public function upgrade($buildCacheView = false, $workSpace = null, $onedb = false, $lang = 'en', array $arrayOptTranslation = null) { if ($workSpace === null) { - $workSpace = config("sys_sys"); + $workSpace = config("system.workspace"); } if (is_null($arrayOptTranslation)) { $arrayOptTranslation = ['updateXml' => true, 'updateMafe' => true]; @@ -226,7 +226,7 @@ class WorkspaceTools public function updateStructureDirectories($workSpace = null) { if ($workSpace === null) { - $workSpace = config("sys_sys"); + $workSpace = config("system.workspace"); } $start = microtime(true); CLI::logging("> Updating cases directories structure...\n"); @@ -479,7 +479,7 @@ class WorkspaceTools public function upgradeContent($workSpace = null) { if ($workSpace === null) { - $workSpace = config("sys_sys"); + $workSpace = config("system.workspace"); } $this->initPropel(true); //require_once 'classes/model/Translation.php'; @@ -1748,13 +1748,13 @@ class WorkspaceTools $aParameters = array('dbHost' => $dbHost, 'dbUser' => $dbUser, 'dbPass' => $dbPass); //Restore - if (!defined("SYS_SYS")) { + if (empty(config("system.workspace"))) { define("SYS_SYS", $workspaceName); - config(["sys_sys" => $workspaceName]); + config(["system.workspace" => $workspaceName]); } if (!defined("PATH_DATA_SITE")) { - define("PATH_DATA_SITE", PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP); + define("PATH_DATA_SITE", PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP); } $pmVersionWorkspaceToRestore = (preg_match("/^([\d\.]+).*$/", $metadata->PM_VERSION, $arrayMatch)) ? $arrayMatch[1] : ""; @@ -3950,7 +3950,7 @@ class WorkspaceTools private function updateFrameworkPaths($workSpace = null) { if ($workSpace === null) { - $workSpace = config("sys_sys"); + $workSpace = config("system.workspace"); } $paths = [ PATH_DATA.'framework' => 0770, diff --git a/workflow/engine/classes/class.pmFunctions.php b/workflow/engine/classes/class.pmFunctions.php index 3f1b998dd..85c74377c 100644 --- a/workflow/engine/classes/class.pmFunctions.php +++ b/workflow/engine/classes/class.pmFunctions.php @@ -239,7 +239,7 @@ function literalDate ($date, $lang = 'en') */ function executeQuery ($SqlStatement, $DBConnectionUID = 'workflow', $aParameter = array()) { - $sysSys = (defined("SYS_SYS"))? config("sys_sys") : "Undefined"; + $sysSys = (!empty(config("system.workspace")))? config("system.workspace") : "Undefined"; $aContext = \Bootstrap::getDefaultContextLog(); $con = Propel::getConnection( $DBConnectionUID ); $con->begin(); @@ -537,7 +537,7 @@ function WSOpen ($force = false) ); if (! isset( $_SESSION["WS_END_POINT"] )) { - $defaultEndpoint = $_SERVER["REQUEST_SCHEME"] . "://" . $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . "/sys" . config("sys_sys") . "/en/classic/services/wsdl2"; + $defaultEndpoint = $_SERVER["REQUEST_SCHEME"] . "://" . $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . "/sys" . config("system.workspace") . "/en/classic/services/wsdl2"; } $endpoint = isset( $_SESSION["WS_END_POINT"] ) ? $_SESSION["WS_END_POINT"] : $defaultEndpoint; @@ -3455,7 +3455,7 @@ function PMFCaseLink($caseUid, $workspace = null, $language = null, $skin = null if ($arrayApplicationData === false) { return false; } - $workspace = (!empty($workspace)) ? $workspace : config("sys_sys"); + $workspace = (!empty($workspace)) ? $workspace : config("system.workspace"); $language = (!empty($language)) ? $language : SYS_LANG; $skin = (!empty($skin)) ? $skin : SYS_SKIN; diff --git a/workflow/engine/classes/class.pmScript.php b/workflow/engine/classes/class.pmScript.php index 37fc7f510..2b8179bed 100644 --- a/workflow/engine/classes/class.pmScript.php +++ b/workflow/engine/classes/class.pmScript.php @@ -45,16 +45,16 @@ use ProcessMaker\Plugins\PluginRegistry; */ function __autoload ($sClassName) { - if (defined( 'SYS_SYS' )) { - $sPath = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; + if (!empty(config("system.workspace"))) { + $sPath = PATH_DB . config("system.workspace") . PATH_SEP . 'classes' . PATH_SEP; if (file_exists( $sPath . $sClassName . '.php' )) { require_once $sPath . $sClassName . '.php'; } } } -if (defined('SYS_SYS') && (!defined('PATH_DATA_SITE') || !defined('PATH_WORKSPACE'))) { - Bootstrap::setConstantsRelatedWs(config("sys_sys")); +if (!empty(config("system.workspace")) && (!defined('PATH_DATA_SITE') || !defined('PATH_WORKSPACE'))) { + Bootstrap::setConstantsRelatedWs(config("system.workspace")); } //Add External Triggers diff --git a/workflow/engine/classes/class.webdav.php b/workflow/engine/classes/class.webdav.php index cfa5a6bff..059742da9 100644 --- a/workflow/engine/classes/class.webdav.php +++ b/workflow/engine/classes/class.webdav.php @@ -39,7 +39,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server public function ServeRequest($base = false) { //$this->base = '/'; - $this->uriBase = '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/webdav/'; + $this->uriBase = '/sys' . config("system.workspace") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/webdav/'; // let the base class do all the work parent::ServeRequest(); @@ -72,7 +72,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server // prepare property array $files["files"] = array(); - $pathClasses = PATH_DB . PATH_SEP . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; + $pathClasses = PATH_DB . PATH_SEP . config("system.workspace") . PATH_SEP . 'classes' . PATH_SEP; if (count($paths) == 0 && is_dir($pathClasses)) { $props = array(); $props[] = $this->mkprop("displayname", 'Classes'); @@ -110,7 +110,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server } //path classes - $pathProcesses = PATH_DB . config("sys_sys") . PATH_SEP; + $pathProcesses = PATH_DB . config("system.workspace") . PATH_SEP; if (count($paths) == 0 && is_dir($pathProcesses)) { $props = array(); $props[] = $this->mkprop("displayname", 'Processes'); @@ -404,7 +404,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server $options = $filter->xssFilterHard($options); $paths = $filter->xssFilterHard($this->paths); - $pathClasses = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; + $pathClasses = PATH_DB . config("system.workspace") . PATH_SEP . 'classes' . PATH_SEP; if (count($paths) > 0 && $paths[0] == 'classes' && is_dir($pathClasses)) { $fsFile = $pathClasses . $paths[1]; $fsFile = $filter->xssFilterHard($fsFile); @@ -419,7 +419,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server } } - $pathProcesses = PATH_DB . config("sys_sys") . PATH_SEP; + $pathProcesses = PATH_DB . config("system.workspace") . PATH_SEP; if (count($paths) > 0 && $paths[0] == 'processes' && is_dir($pathProcesses)) { if (count($paths) == 4 && $paths[2] == 'xmlforms') { $pathXmlform = $pathProcesses . 'xmlForms' . PATH_SEP . $paths[1] . PATH_SEP; @@ -636,7 +636,7 @@ class ProcessMakerWebDav extends HTTP_WebDAV_Server } } - $pathProcesses = PATH_DB . config("sys_sys") . PATH_SEP; + $pathProcesses = PATH_DB . config("system.workspace") . PATH_SEP; if (count($paths) > 0 && $paths[0] == 'processes' && is_dir($pathProcesses)) { if ($paths[2] == 'xmlforms') { $pathTemplates = $pathProcesses . 'xmlForms' . PATH_SEP . $paths[1] . PATH_SEP; diff --git a/workflow/engine/classes/model/AdditionalTables.php b/workflow/engine/classes/model/AdditionalTables.php index f2f3f30b5..3422cf0ca 100644 --- a/workflow/engine/classes/model/AdditionalTables.php +++ b/workflow/engine/classes/model/AdditionalTables.php @@ -332,7 +332,7 @@ class AdditionalTables extends BaseAdditionalTables { try { $aData = $this->load($sUID, true); - $sPath = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; + $sPath = PATH_DB . config("system.workspace") . PATH_SEP . 'classes' . PATH_SEP; $sClassName = ($aData['ADD_TAB_CLASS_NAME'] != '' ? $aData['ADD_TAB_CLASS_NAME'] : $this->getPHPName($aData['ADD_TAB_NAME'])); @@ -383,7 +383,7 @@ class AdditionalTables extends BaseAdditionalTables $_SESSION["PROCESS"] = $aData['PRO_UID']; } $aData['DBS_UID'] = $aData['DBS_UID'] ? $aData['DBS_UID'] : 'workflow'; - $sPath = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; + $sPath = PATH_DB . config("system.workspace") . PATH_SEP . 'classes' . PATH_SEP; $sClassName = ($aData['ADD_TAB_CLASS_NAME'] != '' ? $aData['ADD_TAB_CLASS_NAME'] : $this->getPHPName($aData['ADD_TAB_NAME'])); @@ -531,7 +531,7 @@ class AdditionalTables extends BaseAdditionalTables { try { $aData = $this->load($sUID, true); - $sPath = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; + $sPath = PATH_DB . config("system.workspace") . PATH_SEP . 'classes' . PATH_SEP; $sClassName = ($aData['ADD_TAB_CLASS_NAME'] != '' ? $aData['ADD_TAB_CLASS_NAME'] : $this->getPHPName($aData['ADD_TAB_NAME'])); @@ -550,7 +550,7 @@ class AdditionalTables extends BaseAdditionalTables { try { $aData = $this->load($sUID, true); - $sPath = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; + $sPath = PATH_DB . config("system.workspace") . PATH_SEP . 'classes' . PATH_SEP; $sClassName = ($aData['ADD_TAB_CLASS_NAME'] != '' ? $aData['ADD_TAB_CLASS_NAME'] : $this->getPHPName($aData['ADD_TAB_NAME'])); @@ -604,7 +604,7 @@ class AdditionalTables extends BaseAdditionalTables { try { $aData = $this->load($sUID, true); - $sPath = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; + $sPath = PATH_DB . config("system.workspace") . PATH_SEP . 'classes' . PATH_SEP; $sClassName = ($aData['ADD_TAB_CLASS_NAME'] != '' ? $aData['ADD_TAB_CLASS_NAME'] : $this->getPHPName($aData['ADD_TAB_NAME'])); @@ -632,7 +632,7 @@ class AdditionalTables extends BaseAdditionalTables try { //$sPMUID = $aFields['PM_UNIQUE_ID']; $aData = $this->load($sUID, true); - $sPath = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; + $sPath = PATH_DB . config("system.workspace") . PATH_SEP . 'classes' . PATH_SEP; $sClassName = ($aData['ADD_TAB_CLASS_NAME'] != '' ? $aData['ADD_TAB_CLASS_NAME'] : $this->getPHPName($aData['ADD_TAB_NAME'])); @@ -679,7 +679,7 @@ class AdditionalTables extends BaseAdditionalTables { try { $aData = $this->load($sUID, true); - $sPath = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; + $sPath = PATH_DB . config("system.workspace") . PATH_SEP . 'classes' . PATH_SEP; $sClassName = ($aData['ADD_TAB_CLASS_NAME'] != '' ? $aData['ADD_TAB_CLASS_NAME'] : $this->getPHPName($aData['ADD_TAB_NAME'])); @@ -1159,7 +1159,7 @@ class AdditionalTables extends BaseAdditionalTables $sClassName = $this->getPHPName($sTableName); } - $sPath = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; + $sPath = PATH_DB . config("system.workspace") . PATH_SEP . 'classes' . PATH_SEP; if (!file_exists($sPath)) { G::mk_dir($sPath); } diff --git a/workflow/engine/classes/model/AddonsStore.php b/workflow/engine/classes/model/AddonsStore.php index c4d7e3b99..b5d286826 100644 --- a/workflow/engine/classes/model/AddonsStore.php +++ b/workflow/engine/classes/model/AddonsStore.php @@ -367,7 +367,7 @@ class AddonsStore extends BaseAddonsStore $sStatus = $oDetails->isEnabled() ? G::LoadTranslation('ID_ENABLED') : G::LoadTranslation('ID_DISABLED'); if ($oDetails->getWorkspaces()) { - if (!in_array(config("sys_sys"), $oDetails->getWorkspaces())) { + if (!in_array(config("system.workspace"), $oDetails->getWorkspaces())) { continue; } } diff --git a/workflow/engine/classes/model/CaseScheduler.php b/workflow/engine/classes/model/CaseScheduler.php index ffc7735d9..bd9833fef 100644 --- a/workflow/engine/classes/model/CaseScheduler.php +++ b/workflow/engine/classes/model/CaseScheduler.php @@ -332,7 +332,7 @@ class CaseScheduler extends BaseCaseScheduler } } - $url = SERVER_NAME . $port . "/sys" . config("sys_sys") . "/" . SYS_LANG . "/classic/services/wsdl2"; + $url = SERVER_NAME . $port . "/sys" . config("system.workspace") . "/" . SYS_LANG . "/classic/services/wsdl2"; $testConnection = true; try { diff --git a/workflow/engine/classes/model/Content.php b/workflow/engine/classes/model/Content.php index 061b2f3e2..86180e6e8 100644 --- a/workflow/engine/classes/model/Content.php +++ b/workflow/engine/classes/model/Content.php @@ -315,7 +315,7 @@ class Content extends BaseContent public function regenerateContent ($langs, $workSpace = null) { if ($workSpace === null) { - $workSpace = config("sys_sys"); + $workSpace = config("system.workspace"); } //Search the language $key = array_search( 'en', $langs ); diff --git a/workflow/engine/classes/model/Process.php b/workflow/engine/classes/model/Process.php index 9f5f38b23..4ae0c0030 100644 --- a/workflow/engine/classes/model/Process.php +++ b/workflow/engine/classes/model/Process.php @@ -739,7 +739,7 @@ class Process extends BaseProcess } - $memcache = & PMmemcached::getSingleton( config("sys_sys") ); + $memcache = & PMmemcached::getSingleton( config("system.workspace") ); if (isset($memcache) && $memcache->enabled == 1 ) { return $aProcesses; } @@ -766,7 +766,7 @@ class Process extends BaseProcess GROUP BY PRO_UID, APP_STATUS*/ require_once 'classes/model/Application.php'; - $memcache = & PMmemcached::getSingleton( config("sys_sys") ); + $memcache = & PMmemcached::getSingleton( config("system.workspace") ); $memkey = 'getCasesCountInAllProcesses'; if (($aProcesses = $memcache->get( $memkey )) === false) { $oCriteria = new Criteria( 'workflow' ); @@ -877,7 +877,7 @@ class Process extends BaseProcess $limit = 25; $start = 0; - $memcache = PMmemcached::getSingleton( config("sys_sys") ); + $memcache = PMmemcached::getSingleton( config("system.workspace") ); for ($start = 0; $start <= 50 - 1; $start ++) { $memkey = "processList-allProcesses-" . ($start * $limit) . "-" . $limit; diff --git a/workflow/engine/classes/model/UsersProperties.php b/workflow/engine/classes/model/UsersProperties.php index cf3b417a0..7b378188f 100644 --- a/workflow/engine/classes/model/UsersProperties.php +++ b/workflow/engine/classes/model/UsersProperties.php @@ -258,10 +258,10 @@ class UsersProperties extends BaseUsersProperties $url = $this->_getDefaultLocation(); return $url; } else { - $url = '/sys' . config("sys_sys") . '/' . $this->lang . '/' . $_COOKIE['workspaceSkin'] . '/main'; + $url = '/sys' . config("system.workspace") . '/' . $this->lang . '/' . $_COOKIE['workspaceSkin'] . '/main'; } } else { - $url = '/sys' . config("sys_sys") . '/' . $this->lang . '/' . SYS_SKIN . '/main'; + $url = '/sys' . config("system.workspace") . '/' . $this->lang . '/' . SYS_SKIN . '/main'; } global $RBAC; $oConf = new Configurations(); @@ -330,9 +330,9 @@ class UsersProperties extends BaseUsersProperties $pathMethod = $detail->getPathMethod(); if (isset($pathMethod) && $detail->equalRoleCodeTo($userRole)) { if (isset($_COOKIE['workspaceSkin'])) { - $url = '/sys' . config("sys_sys") . '/' . $this->lang . '/' . $_COOKIE['workspaceSkin'] . '/' . $pathMethod; + $url = '/sys' . config("system.workspace") . '/' . $this->lang . '/' . $_COOKIE['workspaceSkin'] . '/' . $pathMethod; } else { - $url = '/sys' . config("sys_sys") . '/' . $this->lang . '/' . SYS_SKIN . '/' . $pathMethod; + $url = '/sys' . config("system.workspace") . '/' . $this->lang . '/' . SYS_SKIN . '/' . $pathMethod; } } } @@ -376,7 +376,7 @@ class UsersProperties extends BaseUsersProperties case 'SINGLE': $_SESSION['user_experience'] = $uxType; $_SESSION['user_last_skin'] = SYS_SKIN; - $url = '/sys' . config("sys_sys") . '/' . $this->lang . '/uxs/' . 'home'; + $url = '/sys' . config("system.workspace") . '/' . $this->lang . '/uxs/' . 'home'; break; } @@ -393,11 +393,11 @@ class UsersProperties extends BaseUsersProperties $oConf = new Configurations(); $oConf->loadConfig( $x, 'USER_PREFERENCES', '', '', $_SESSION['USER_LOGGED'], '' ); - //$baseUrl = '/sys' . config("sys_sys") . '/' . $this->lang . '/' . SYS_SKIN . '/'; + //$baseUrl = '/sys' . config("system.workspace") . '/' . $this->lang . '/' . SYS_SKIN . '/'; if (isset($_COOKIE['workspaceSkin'])) { - $baseUrl = '/sys' . config("sys_sys") . '/' . $this->lang . '/' . $_COOKIE['workspaceSkin'] . '/'; + $baseUrl = '/sys' . config("system.workspace") . '/' . $this->lang . '/' . $_COOKIE['workspaceSkin'] . '/'; } else { - $baseUrl = '/sys' . config("sys_sys") . '/' . $this->lang . '/' . SYS_SKIN . '/'; + $baseUrl = '/sys' . config("system.workspace") . '/' . $this->lang . '/' . SYS_SKIN . '/'; } $url = ''; diff --git a/workflow/engine/config/databases.php b/workflow/engine/config/databases.php index c27df9f39..c6d8c3761 100644 --- a/workflow/engine/config/databases.php +++ b/workflow/engine/config/databases.php @@ -23,12 +23,12 @@ * */ -if (defined('PATH_DB') && defined('SYS_SYS')) { +if (defined('PATH_DB') && !empty(config("system.workspace"))) { - if (!file_exists(PATH_DB . config("sys_sys") . '/db.php')) - throw new Exception("Could not find db.php in current workspace " . config("sys_sys")); + if (!file_exists(PATH_DB . config("system.workspace") . '/db.php')) + throw new Exception("Could not find db.php in current workspace " . config("system.workspace")); - require_once(PATH_DB . config("sys_sys") . '/db.php'); + require_once(PATH_DB . config("system.workspace") . '/db.php'); //to do: enable for other databases $dbType = DB_ADAPTER; $dsn = DB_ADAPTER . '://' . DB_USER . ':' . urlencode(DB_PASS) . '@' . DB_HOST . '/' . DB_NAME; diff --git a/workflow/engine/controllers/admin.php b/workflow/engine/controllers/admin.php index a0acc87f9..d5fe5ff68 100644 --- a/workflow/engine/controllers/admin.php +++ b/workflow/engine/controllers/admin.php @@ -314,7 +314,7 @@ class Admin extends Controller ); } - $properties[] = array ( G::LoadTranslation('ID_WORKSPACE') ,defined( "SYS_SYS" ) ? config("sys_sys") : "Not defined",$pmSection + $properties[] = array(G::LoadTranslation('ID_WORKSPACE'), !empty(config("system.workspace")) ? config("system.workspace") : "Not defined", $pmSection ); $properties[] = array ( G::LoadTranslation('ID_SERVER_PROTOCOL') ,getenv( 'SERVER_PROTOCOL' ),$sysSection diff --git a/workflow/engine/controllers/adminProxy.php b/workflow/engine/controllers/adminProxy.php index 8cb7dd34a..660de524f 100644 --- a/workflow/engine/controllers/adminProxy.php +++ b/workflow/engine/controllers/adminProxy.php @@ -117,7 +117,7 @@ class adminProxy extends HttpProxyController $this->success = true; $this->restart = $restart; - $this->url = "/sys" . config("sys_sys") . "/" . (($sysConf["default_lang"] != "")? $sysConf["default_lang"] : ((defined("SYS_LANG") && SYS_LANG != "")? SYS_LANG : "en")) . "/" . $sysConf["default_skin"] . $urlPart; + $this->url = "/sys" . config("system.workspace") . "/" . (($sysConf["default_lang"] != "")? $sysConf["default_lang"] : ((defined("SYS_LANG") && SYS_LANG != "")? SYS_LANG : "en")) . "/" . $sysConf["default_skin"] . $urlPart; $this->message = 'Saved Successfully'; $msg = ""; if ($httpData->proxy_host != '' || $httpData->proxy_port != '' || $httpData->proxy_user != '') { @@ -1191,7 +1191,7 @@ class adminProxy extends HttpProxyController $snameLogo = self::changeNamelogo($snameLogo); $oConf = new Configurations; $aConf = Array( - 'WORKSPACE_LOGO_NAME' => config("sys_sys"), + 'WORKSPACE_LOGO_NAME' => config("system.workspace"), 'DEFAULT_LOGO_NAME' => $snameLogo ); @@ -1356,7 +1356,7 @@ class adminProxy extends HttpProxyController '%s://%s/sys%s/%s/%s/oauth2/grant', $http, $host, - config("sys_sys"), + config("system.workspace"), $lang, SYS_SKIN ); @@ -1416,7 +1416,7 @@ class adminProxy extends HttpProxyController //On premise or cloud $licInfo = $oServerConf->getProperty( 'LICENSE_INFO' ); - $params['lt'] = isset($licInfo[config("sys_sys")]) ? isset($licInfo[config("sys_sys")]['TYPE'])? $licInfo[config("sys_sys")]['TYPE'] : '' : ''; + $params['lt'] = isset($licInfo[config("system.workspace")]) ? isset($licInfo[config("system.workspace")]['TYPE'])? $licInfo[config("system.workspace")]['TYPE'] : '' : ''; //ProcessMaker Version $params['v'] = System::getVersion(); @@ -1511,7 +1511,7 @@ class adminProxy extends HttpProxyController $params['t'] = (defined('TIME_ZONE') && TIME_ZONE != "Unknown") ? TIME_ZONE : date_default_timezone_get(); $params['w'] = count(System::listWorkspaces()); - $support = PATH_DATA_SITE . G::sanitizeString($licenseManager->info['FIRST_NAME'] . '-' . $licenseManager->info['LAST_NAME'] . '-' . config("sys_sys") . '-' . date('YmdHis'), false, false) . '.spm'; + $support = PATH_DATA_SITE . G::sanitizeString($licenseManager->info['FIRST_NAME'] . '-' . $licenseManager->info['LAST_NAME'] . '-' . config("system.workspace") . '-' . date('YmdHis'), false, false) . '.spm'; file_put_contents($support, serialize($params)); G::streamFile($support, true); G::rm_dir($support); diff --git a/workflow/engine/controllers/caseSchedulerProxy.php b/workflow/engine/controllers/caseSchedulerProxy.php index cc119cb4f..428a007ae 100644 --- a/workflow/engine/controllers/caseSchedulerProxy.php +++ b/workflow/engine/controllers/caseSchedulerProxy.php @@ -97,7 +97,7 @@ class caseSchedulerProxy extends HttpProxyController } else { $http = 'http://'; } - $endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; + $endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("system.workspace") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; @$client = new SoapClient( $endpoint ); $user = $sWS_USER; diff --git a/workflow/engine/controllers/designer.php b/workflow/engine/controllers/designer.php index 55590ff0a..d1fee5cda 100644 --- a/workflow/engine/controllers/designer.php +++ b/workflow/engine/controllers/designer.php @@ -62,7 +62,7 @@ class Designer extends Controller $this->setVar('credentials', base64_encode(json_encode($clientToken))); $this->setVar('isDebugMode', $debug); $this->setVar("distribution", $distribution); - $this->setVar("SYS_SYS", config("sys_sys")); + $this->setVar("SYS_SYS", config("system.workspace")); $this->setVar("SYS_LANG", SYS_LANG); $this->setVar("SYS_SKIN", SYS_SKIN); $this->setVar('HTTP_SERVER_HOSTNAME', System::getHttpServerHostnameRequestsFrontEnd()); @@ -219,7 +219,7 @@ class Designer extends Controller } Tracker::authentication($_SESSION['CASE'], $_SESSION['PIN']); } catch (\Exception $e) { - Bootstrap::registerMonolog('CaseTracker', 400, $e->getMessage(), [], config("sys_sys"), 'processmaker.log'); + Bootstrap::registerMonolog('CaseTracker', 400, $e->getMessage(), [], config("system.workspace"), 'processmaker.log'); \G::header('Location: /errors/error403.php'); die(); } diff --git a/workflow/engine/controllers/home.php b/workflow/engine/controllers/home.php index ff07bad55..33bac845e 100644 --- a/workflow/engine/controllers/home.php +++ b/workflow/engine/controllers/home.php @@ -131,7 +131,7 @@ class Home extends Controller if (!isset($_COOKIE['workspaceSkin'])) { if (substr( $sysConf['default_skin'], 0, 2 ) == 'ux') { $_SESSION['_defaultUserLocation'] = $switchLink; - $switchLink = '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . $sysConf['default_skin'] . '/main'; + $switchLink = '/sys' . config("system.workspace") . '/' . SYS_LANG . '/' . $sysConf['default_skin'] . '/main'; } } @@ -531,7 +531,7 @@ class Home extends Controller $conf = new Configurations(); $generalConfCasesList = $conf->getConfiguration( 'ENVIRONMENT_SETTINGS', '' ); $cases['data'][$i]['DEL_DELEGATE_DATE'] = ''; - if (defined('SYS_SYS')) { + if (!empty(config("system.workspace"))) { if (isset( $generalConfCasesList['casesListDateFormat'] ) && ! empty( $generalConfCasesList['casesListDateFormat'] )) { $cases['data'][$i]['DEL_DELEGATE_DATE'] = $conf->getSystemDate($row['DEL_DELEGATE_DATE'], 'casesListDateFormat'); } diff --git a/workflow/engine/controllers/installer.php b/workflow/engine/controllers/installer.php index 285d5659f..df9c986b0 100644 --- a/workflow/engine/controllers/installer.php +++ b/workflow/engine/controllers/installer.php @@ -919,7 +919,7 @@ class InstallerModule extends Controller define( 'SYSTEM_HASH', $sh ); define( 'PATH_DB', $pathShared . 'sites' . PATH_SEP ); define( 'SYS_SYS', $workspace ); - config(["sys_sys" => $workspace]); + config(["system.workspace" => $workspace]); require_once ("propel/Propel.php"); diff --git a/workflow/engine/controllers/main.php b/workflow/engine/controllers/main.php index b33420bc5..64023e66f 100644 --- a/workflow/engine/controllers/main.php +++ b/workflow/engine/controllers/main.php @@ -17,7 +17,7 @@ class Main extends Controller public function __construct () { - $this->memcache = & PMmemcached::getSingleton( defined( 'SYS_SYS' ) ? config("sys_sys") : '' ); + $this->memcache = & PMmemcached::getSingleton( !empty(config("system.workspace")) ? config("system.workspace") : '' ); define( 'ERROR_EXCEPTION', 1 ); define( 'INFO_EXCEPTION', 3 ); @@ -40,7 +40,7 @@ class Main extends Controller $this->setVar( 'pipe', isset( $_SESSION['USR_USERNAME'] ) ? ' | ' : '' ); $this->setVar( 'rolename', $this->getUserRole() ); $this->setVar( 'logout', G::LoadTranslation( 'ID_LOGOUT' ) ); - $this->setVar( 'workspace', defined( 'SYS_SYS' ) ? ucfirst( config("sys_sys") ) : '' ); + $this->setVar( 'workspace', !empty(config("system.workspace")) ? ucfirst( config("system.workspace") ) : '' ); $this->setVar( 'user_avatar', 'users/users_ViewPhotoGrid?pUID=' . $_SESSION['USER_LOGGED'] . '&h=' . rand() ); // license notification @@ -464,7 +464,7 @@ class Main extends Controller { $sCompanyLogo = '/images/processmaker2.logo2.png'; - if (defined( "SYS_SYS" )) { + if (!empty(config("system.workspace"))) { if (($aFotoSelect = $this->memcache->get( 'aFotoSelect' )) === false) { $oLogoR = new ReplacementLogo(); $aFotoSelect = $oLogoR->getNameLogo( (isset( $_SESSION['USER_LOGGED'] )) ? $_SESSION['USER_LOGGED'] : '' ); @@ -480,9 +480,9 @@ class Main extends Controller $logoPlugin = $oPluginRegistry->getCompanyLogo( $sCompanyLogo ); if ($logoPlugin != '/images/processmaker2.logo2.png') { $sCompanyLogo = $logoPlugin; - } elseif (isset( $sFotoSelect ) && $sFotoSelect != '' && ! (strcmp( $sWspaceSelect, config("sys_sys") ))) { + } elseif (isset( $sFotoSelect ) && $sFotoSelect != '' && ! (strcmp( $sWspaceSelect, config("system.workspace") ))) { $sCompanyLogo = $oPluginRegistry->getCompanyLogo( $sFotoSelect ); - $sCompanyLogo = "/sys" . config("sys_sys") . "/" . SYS_LANG . "/" . SYS_SKIN . "/adminProxy/showLogoFile?id=" . base64_encode( $sCompanyLogo ); + $sCompanyLogo = "/sys" . config("system.workspace") . "/" . SYS_LANG . "/" . SYS_SKIN . "/adminProxy/showLogoFile?id=" . base64_encode( $sCompanyLogo ); } } return $sCompanyLogo; @@ -778,7 +778,7 @@ class Main extends Controller ); } - $properties[] = array ( G::LoadTranslation('ID_WORKSPACE') ,defined( "SYS_SYS" ) ? config("sys_sys") : "Not defined",$pmSection + $properties[] = array ( G::LoadTranslation('ID_WORKSPACE') ,!empty(config("system.workspace")) ? config("system.workspace") : "Not defined",$pmSection ); $properties[] = array ( G::LoadTranslation('ID_SERVER_PROTOCOL') ,getenv( 'SERVER_PROTOCOL' ),$sysSection diff --git a/workflow/engine/controllers/pmTables.php b/workflow/engine/controllers/pmTables.php index 1ad74be00..06607a2de 100644 --- a/workflow/engine/controllers/pmTables.php +++ b/workflow/engine/controllers/pmTables.php @@ -147,7 +147,7 @@ class pmTables extends Controller public function streamExported ($httpData) { - $PUBLIC_ROOT_PATH = PATH_DATA . 'sites' . PATH_SEP . config("sys_sys") . PATH_SEP . 'public' . PATH_SEP; + $PUBLIC_ROOT_PATH = PATH_DATA . 'sites' . PATH_SEP . config("system.workspace") . PATH_SEP . 'public' . PATH_SEP; $sFileName = $httpData->f; $realPath = $PUBLIC_ROOT_PATH . $sFileName; diff --git a/workflow/engine/controllers/pmTablesProxy.php b/workflow/engine/controllers/pmTablesProxy.php index 8aef2ea59..a0d1582fa 100644 --- a/workflow/engine/controllers/pmTablesProxy.php +++ b/workflow/engine/controllers/pmTablesProxy.php @@ -117,7 +117,7 @@ class pmTablesProxy extends HttpProxyController $dbConn = new DbConnections(); $dbConnections = $dbConn->getConnectionsProUid( $proUid, array('mysql') ); - $workSpace = new WorkspaceTools(config("sys_sys")); + $workSpace = new WorkspaceTools(config("system.workspace")); $workspaceDB = $workSpace->getDBInfo(); if ($workspaceDB['DB_NAME'] == $workspaceDB['DB_RBAC_NAME']) { @@ -399,7 +399,7 @@ class pmTablesProxy extends HttpProxyController $primaryKeys = $oAdditionalTables->getPrimaryKeys( 'keys' ); $this->className = $table['ADD_TAB_CLASS_NAME']; $this->classPeerName = $this->className . 'Peer'; - $sPath = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; + $sPath = PATH_DB . config("system.workspace") . PATH_SEP . 'classes' . PATH_SEP; if (! file_exists( $sPath . $this->className . '.php' )) { throw new Exception( 'Update:: ' . G::loadTranslation( 'ID_PMTABLE_CLASS_DOESNT_EXIST', $this->className ) ); @@ -440,7 +440,7 @@ class pmTablesProxy extends HttpProxyController $table = $oAdditionalTables->load( $httpData->id, true ); $this->className = $table['ADD_TAB_CLASS_NAME']; $this->classPeerName = $this->className . 'Peer'; - $sPath = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; + $sPath = PATH_DB . config("system.workspace") . PATH_SEP . 'classes' . PATH_SEP; if (! file_exists( $sPath . $this->className . '.php' )) { throw new Exception( 'Destroy:: ' . G::loadTranslation( 'ID_PMTABLE_CLASS_DOESNT_EXIST', $this->className ) ); @@ -664,7 +664,7 @@ class pmTablesProxy extends HttpProxyController $rows = $resultData['rows']; $count = $resultData['count']; - $PUBLIC_ROOT_PATH = PATH_DATA . 'sites' . PATH_SEP . config("sys_sys") . PATH_SEP . 'public' . PATH_SEP; + $PUBLIC_ROOT_PATH = PATH_DATA . 'sites' . PATH_SEP . config("system.workspace") . PATH_SEP . 'public' . PATH_SEP; $filenameOnly = strtolower($aAdditionalTables['ADD_TAB_NAME'] . "_" . date("Y-m-d") . '_' . date("Hi") . ".csv"); $filename = $PUBLIC_ROOT_PATH . $filenameOnly; $fp = fopen($filename, "wb"); @@ -733,7 +733,7 @@ class pmTablesProxy extends HttpProxyController $_SESSION['FILES_FORM'] = $_FILES['form']; - $PUBLIC_ROOT_PATH = PATH_DATA . 'sites' . PATH_SEP . config("sys_sys") . PATH_SEP . 'public' . PATH_SEP; + $PUBLIC_ROOT_PATH = PATH_DATA . 'sites' . PATH_SEP . config("system.workspace") . PATH_SEP . 'public' . PATH_SEP; $filename = $_FILES['form']['name']['FILENAME']; $tempName = $_FILES['form']['tmp_name']['FILENAME']; @@ -923,7 +923,7 @@ class pmTablesProxy extends HttpProxyController $result = new stdClass(); $net = new Net( G::getIpAddress() ); - $META = " \n-----== ProcessMaker Open Source Private Tables ==-----\n" . " @Ver: 1.0 Oct-2009\n" . " @Processmaker version: " . System::getVersion() . "\n" . " -------------------------------------------------------\n" . " @Export Date: " . date( "l jS \of F Y h:i:s A" ) . "\n" . " @Server address: " . getenv( 'SERVER_NAME' ) . " (" . getenv( 'SERVER_ADDR' ) . ")\n" . " @Client address: " . $net->hostname . "\n" . " @Workspace: " . config("sys_sys") . "\n" . " @Export trace back:\n\n"; + $META = " \n-----== ProcessMaker Open Source Private Tables ==-----\n" . " @Ver: 1.0 Oct-2009\n" . " @Processmaker version: " . System::getVersion() . "\n" . " -------------------------------------------------------\n" . " @Export Date: " . date( "l jS \of F Y h:i:s A" ) . "\n" . " @Server address: " . getenv( 'SERVER_NAME' ) . " (" . getenv( 'SERVER_ADDR' ) . ")\n" . " @Client address: " . $net->hostname . "\n" . " @Workspace: " . config("system.workspace") . "\n" . " @Export trace back:\n\n"; $EXPORT_TRACEBACK = Array (); $c = 0; @@ -947,9 +947,9 @@ class pmTablesProxy extends HttpProxyController $META .= $sTrace; ///////////////EXPORT PROCESS - $PUBLIC_ROOT_PATH = PATH_DATA . 'sites' . PATH_SEP . config("sys_sys") . PATH_SEP . 'public' . PATH_SEP; + $PUBLIC_ROOT_PATH = PATH_DATA . 'sites' . PATH_SEP . config("system.workspace") . PATH_SEP . 'public' . PATH_SEP; - $filenameOnly = strtolower( 'SYS-' . config("sys_sys") . "_" . date( "Y-m-d" ) . '_' . date( "Hi" ) . ".pmt" ); + $filenameOnly = strtolower( 'SYS-' . config("system.workspace") . "_" . date( "Y-m-d" ) . '_' . date( "Hi" ) . ".pmt" ); $filename = $PUBLIC_ROOT_PATH . $filenameOnly; $fp = fopen( $filename, "wb" ); diff --git a/workflow/engine/controllers/strategicDashboard.php b/workflow/engine/controllers/strategicDashboard.php index d4d51ecb7..80bb1d0c7 100644 --- a/workflow/engine/controllers/strategicDashboard.php +++ b/workflow/engine/controllers/strategicDashboard.php @@ -33,7 +33,7 @@ class StrategicDashboard extends Controller $user = new Users(); $user = $user->load($RBAC->aUserInfo['USER_INFO']['USR_UID']); $this->usrUnitCost = $this->currencySymbolToShow($user); - $this->urlProxy = System::getHttpServerHostnameRequestsFrontEnd() . '/api/1.0/' . config("sys_sys") . '/'; + $this->urlProxy = System::getHttpServerHostnameRequestsFrontEnd() . '/api/1.0/' . config("system.workspace") . '/'; //change $clientId = 'x-pm-local-client'; $client = $this->getClientCredentials($clientId); @@ -194,7 +194,7 @@ class StrategicDashboard extends Controller $this->setView( 'strategicDashboard/viewDashboard' ); $this->setVar('urlProxy', $this->urlProxy); - $this->setVar('SYS_SYS', config("sys_sys")); + $this->setVar('SYS_SYS', config("system.workspace")); $this->setVar('usrId', $this->usrId); $this->setVar('credentials', $this->clientToken); $this->setVar('unitCost', $this->usrUnitCost); diff --git a/workflow/engine/controllers/webEntryProxy.php b/workflow/engine/controllers/webEntryProxy.php index bcb096212..20ea01856 100644 --- a/workflow/engine/controllers/webEntryProxy.php +++ b/workflow/engine/controllers/webEntryProxy.php @@ -21,8 +21,8 @@ class webEntryProxy extends HttpProxyController $editEvent['EVN_CONDITIONS'] = null; $event->update( $editEvent ); - unlink( PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP . "public" . PATH_SEP . $pro_uid . PATH_SEP . $filename ); - unlink( PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP . "public" . PATH_SEP . $pro_uid . PATH_SEP . str_replace( ".php", "Post", $filename ) . ".php" ); + unlink( PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP . "public" . PATH_SEP . $pro_uid . PATH_SEP . $filename ); + unlink( PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP . "public" . PATH_SEP . $pro_uid . PATH_SEP . str_replace( ".php", "Post", $filename ) . ".php" ); $this->success = true; $this->msg = G::LoadTranslation( 'ID_WEB_ENTRY_SUCCESS_DELETE' ); @@ -46,7 +46,7 @@ class webEntryProxy extends HttpProxyController $http = 'http://'; } - $endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; + $endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("system.workspace") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; @$client = new SoapClient( $endpoint ); $user = $sWS_USER; @@ -122,8 +122,8 @@ class webEntryProxy extends HttpProxyController $pro_uid = $params->pro_uid; $filename = $xDYNA; $filename = $filename . '.php'; - unlink( PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP . "public" . PATH_SEP . $pro_uid . PATH_SEP . $filename ); - unlink( PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP . "public" . PATH_SEP . $pro_uid . PATH_SEP . str_replace( ".php", "Post", $filename ) . ".php" ); + unlink( PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP . "public" . PATH_SEP . $pro_uid . PATH_SEP . $filename ); + unlink( PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP . "public" . PATH_SEP . $pro_uid . PATH_SEP . str_replace( ".php", "Post", $filename ) . ".php" ); } $pathProcess = PATH_DATA_SITE . 'public' . PATH_SEP . $sPRO_UID . PATH_SEP; @@ -167,8 +167,8 @@ class webEntryProxy extends HttpProxyController $pluginTpl = PATH_CORE . 'templates' . PATH_SEP . 'processes' . PATH_SEP . 'webentryPost.tpl'; $template = new TemplatePower( $pluginTpl ); $template->prepare(); - $template->assign( 'wsdlUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2' ); - $template->assign( 'wsUploadUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/upload' ); + $template->assign( 'wsdlUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . config("system.workspace") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2' ); + $template->assign( 'wsUploadUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . config("system.workspace") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/upload' ); $template->assign( 'processUid', $sPRO_UID ); $template->assign( 'dynaformUid', $sDYNAFORM ); $template->assign( 'taskUid', $sTASKS ); @@ -184,7 +184,7 @@ class webEntryProxy extends HttpProxyController $template->assign( 'dynaform', $dynTitle ); $template->assign( 'timestamp', date( 'l jS \of F Y h:i:s A' ) ); - $template->assign( 'ws', config("sys_sys") ); + $template->assign( 'ws', config("system.workspace") ); $template->assign( 'version', System::getVersion() ); $fileName = $pathProcess . $dynTitle . 'Post.php'; @@ -218,7 +218,7 @@ class webEntryProxy extends HttpProxyController $aDataEvent['EVN_CONDITIONS'] = $sWS_USER; $output = $oEvent->update( $aDataEvent ); - $link = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $sPRO_UID . '/' . $dynTitle . '.php'; + $link = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("system.workspace") . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $sPRO_UID . '/' . $dynTitle . '.php'; $this->success = true; $this->msg = G::LoadTranslation( 'ID_WEB_ENTRY_SUCCESS_NEW' ); diff --git a/workflow/engine/methods/cases/caseConsolidated.php b/workflow/engine/methods/cases/caseConsolidated.php index 2df5c5241..699a96237 100644 --- a/workflow/engine/methods/cases/caseConsolidated.php +++ b/workflow/engine/methods/cases/caseConsolidated.php @@ -263,7 +263,7 @@ if ($sStatus == '1') { $oAdditionalTables->createPropelClasses($tableName, $sClassName, $aFieldsClases, $sTasUid); } else { - $sPath = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; + $sPath = PATH_DB . config("system.workspace") . PATH_SEP . 'classes' . PATH_SEP; @unlink($sPath . $sClassName . '.php'); @unlink($sPath . $sClassName . 'Peer.php'); @unlink($sPath . PATH_SEP . 'map' . PATH_SEP . $sClassName . 'MapBuilder.php'); diff --git a/workflow/engine/methods/cases/casesConsolidatedListExtJs.php b/workflow/engine/methods/cases/casesConsolidatedListExtJs.php index e4041384c..3a9cd1309 100644 --- a/workflow/engine/methods/cases/casesConsolidatedListExtJs.php +++ b/workflow/engine/methods/cases/casesConsolidatedListExtJs.php @@ -71,7 +71,7 @@ while ($rsSql->next()) { } if (count($arrayTabItem) > 0) { - $urlProxy = System::getHttpServerHostnameRequestsFrontEnd() . '/api/1.0/' . config("sys_sys") . '/consolidated/'; + $urlProxy = System::getHttpServerHostnameRequestsFrontEnd() . '/api/1.0/' . config("system.workspace") . '/consolidated/'; $clientId = 'x-pm-local-client'; $client = getClientCredentials($clientId); $authCode = getAuthorizationCode($client); diff --git a/workflow/engine/methods/cases/casesListExtJs.php b/workflow/engine/methods/cases/casesListExtJs.php index 5b488bd1f..6fd980d3b 100644 --- a/workflow/engine/methods/cases/casesListExtJs.php +++ b/workflow/engine/methods/cases/casesListExtJs.php @@ -176,9 +176,9 @@ if ($licensedFeatures->verifyfeature('r19Vm5DK1UrT09MenlLYjZxejlhNUZ1b1NhV0JHWjB if (isset($_COOKIE['dashboardListInbox'])) { $oHeadPublisher->assign('valueFilterStatus', $_COOKIE['dashboardListInbox']); if (PHP_VERSION < 5.2) { - setcookie("dashboardListInbox", '', time() + (24 * 60 * 60), "/sys" . config("sys_sys"), "; HttpOnly"); + setcookie("dashboardListInbox", '', time() + (24 * 60 * 60), "/sys" . config("system.workspace"), "; HttpOnly"); } else { - setcookie("dashboardListInbox", '', time() + (24 * 60 * 60), "/sys" . config("sys_sys"), null, false, true); + setcookie("dashboardListInbox", '', time() + (24 * 60 * 60), "/sys" . config("system.workspace"), null, false, true); } } } diff --git a/workflow/engine/methods/cases/cases_SaveDataSupervisor.php b/workflow/engine/methods/cases/cases_SaveDataSupervisor.php index 1717d9d4b..e12d94aa1 100644 --- a/workflow/engine/methods/cases/cases_SaveDataSupervisor.php +++ b/workflow/engine/methods/cases/cases_SaveDataSupervisor.php @@ -142,8 +142,8 @@ if (isset( $_FILES["form"]["name"] ) && count( $_FILES["form"]["name"] ) > 0) { if($res->status == 0){ $message = $res->message; G::SendMessageText( $message, "ERROR" ); - $backUrlObj = explode( "sys" . config("sys_sys"), $_SERVER['HTTP_REFERER'] ); - G::header( "location: " . "/sys" . config("sys_sys") . $backUrlObj[1] ); + $backUrlObj = explode( "sys" . config("system.workspace"), $_SERVER['HTTP_REFERER'] ); + G::header( "location: " . "/sys" . config("system.workspace") . $backUrlObj[1] ); die(); } @@ -156,8 +156,8 @@ if (isset( $_FILES["form"]["name"] ) && count( $_FILES["form"]["name"] ) > 0) { if ($inpDocMaxFilesize > 0 && $fileSizeByField > 0) { if ($fileSizeByField > $inpDocMaxFilesize) { G::SendMessageText(G::LoadTranslation("ID_SIZE_VERY_LARGE_PERMITTED"), "ERROR"); - $arrayAux1 = explode("sys" . config("sys_sys"), $_SERVER["HTTP_REFERER"]); - G::header("location: /sys" . config("sys_sys") . $arrayAux1[1]); + $arrayAux1 = explode("sys" . config("system.workspace"), $_SERVER["HTTP_REFERER"]); + G::header("location: /sys" . config("system.workspace") . $arrayAux1[1]); exit(0); } } diff --git a/workflow/engine/methods/cases/cases_SaveDocument.php b/workflow/engine/methods/cases/cases_SaveDocument.php index 5ca38442d..02c544479 100644 --- a/workflow/engine/methods/cases/cases_SaveDocument.php +++ b/workflow/engine/methods/cases/cases_SaveDocument.php @@ -54,8 +54,8 @@ if ((isset( $_FILES['form'] )) && ($_FILES['form']['error']['APP_DOC_FILENAME'] break; } G::SendMessageText( $message, "ERROR" ); - $backUrlObj = explode( "sys" . config("sys_sys"), $_SERVER['HTTP_REFERER'] ); - G::header( "location: " . "/sys" . config("sys_sys") . $backUrlObj[1] ); + $backUrlObj = explode( "sys" . config("system.workspace"), $_SERVER['HTTP_REFERER'] ); + G::header( "location: " . "/sys" . config("system.workspace") . $backUrlObj[1] ); die(); } @@ -106,8 +106,8 @@ if(isset($_FILES["form"]["name"]["APP_DOC_FILENAME"]) && isset($_FILES["form"][" if($res->status == 0){ $message = $res->message; G::SendMessageText( $message, "ERROR" ); - $backUrlObj = explode( "sys" . config("sys_sys"), $_SERVER['HTTP_REFERER'] ); - G::header( "location: " . "/sys" . config("sys_sys") . $backUrlObj[1] ); + $backUrlObj = explode( "sys" . config("system.workspace"), $_SERVER['HTTP_REFERER'] ); + G::header( "location: " . "/sys" . config("system.workspace") . $backUrlObj[1] ); die(); } @@ -134,8 +134,8 @@ if (isset($_FILES) && isset($_FILES["form"]) && count($_FILES["form"]) > 0) { } catch (Exception $e) { G::SendMessageText($e->getMessage(), "ERROR"); - $arrayAux = explode("sys" . config("sys_sys"), $_SERVER["HTTP_REFERER"]); - G::header("location: /sys" . config("sys_sys") . $arrayAux[1]); + $arrayAux = explode("sys" . config("system.workspace"), $_SERVER["HTTP_REFERER"]); + G::header("location: /sys" . config("system.workspace") . $arrayAux[1]); exit(0); } } diff --git a/workflow/engine/methods/cases/cases_SchedulerValidateUser.php b/workflow/engine/methods/cases/cases_SchedulerValidateUser.php index 7a0f81380..3edaa6f64 100644 --- a/workflow/engine/methods/cases/cases_SchedulerValidateUser.php +++ b/workflow/engine/methods/cases/cases_SchedulerValidateUser.php @@ -40,7 +40,7 @@ if (G::is_https()) { $http = 'http://'; } -$endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; +$endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("system.workspace") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; $client = new SoapClient($endpoint, $streamContext); $user = $sWS_USER; diff --git a/workflow/engine/methods/cases/cases_ShowDocument.php b/workflow/engine/methods/cases/cases_ShowDocument.php index d5cca7777..178d52697 100644 --- a/workflow/engine/methods/cases/cases_ShowDocument.php +++ b/workflow/engine/methods/cases/cases_ShowDocument.php @@ -109,8 +109,8 @@ if (! $sw_file_exists) { print G::json_encode( $res ); } else { G::SendMessageText( $error_message, "ERROR" ); - $backUrlObj = explode( "sys" . config("sys_sys"), $_SERVER['HTTP_REFERER'] ); - G::header( "location: " . "/sys" . config("sys_sys") . $backUrlObj[1] ); + $backUrlObj = explode( "sys" . config("system.workspace"), $_SERVER['HTTP_REFERER'] ); + G::header( "location: " . "/sys" . config("system.workspace") . $backUrlObj[1] ); die(); } diff --git a/workflow/engine/methods/cases/cases_ShowOutputDocument.php b/workflow/engine/methods/cases/cases_ShowOutputDocument.php index 7df20fc28..9436daea4 100644 --- a/workflow/engine/methods/cases/cases_ShowOutputDocument.php +++ b/workflow/engine/methods/cases/cases_ShowOutputDocument.php @@ -122,8 +122,8 @@ if (!$sw_file_exists) { print G::json_encode( $res ); } else { G::SendMessageText( $error_message, "ERROR" ); - $backUrlObj = explode( "sys" . config("sys_sys"), $_SERVER['HTTP_REFERER'] ); - G::header( "location: " . "/sys" . config("sys_sys") . $backUrlObj[1] ); + $backUrlObj = explode( "sys" . config("system.workspace"), $_SERVER['HTTP_REFERER'] ); + G::header( "location: " . "/sys" . config("system.workspace") . $backUrlObj[1] ); die(); } diff --git a/workflow/engine/methods/cases/main_init.php b/workflow/engine/methods/cases/main_init.php index 23a54933a..812390384 100644 --- a/workflow/engine/methods/cases/main_init.php +++ b/workflow/engine/methods/cases/main_init.php @@ -29,7 +29,7 @@ $oHeadPublisher->addExtJsScript( "cases/main", false ); //Adding a javascript fi $oHeadPublisher->addContent( "cases/main" ); //Adding a html file .html. $keyMem = "USER_PREFERENCES" . $_SESSION["USER_LOGGED"]; -$memcache = &PMmemcached::getSingleton( config("sys_sys") ); +$memcache = &PMmemcached::getSingleton( config("system.workspace") ); if (($arrayConfig = $memcache->get( $keyMem )) === false) { $conf->loadConfig( $x, "USER_PREFERENCES", "", "", $_SESSION["USER_LOGGED"], "" ); diff --git a/workflow/engine/methods/enterprise/addonsStore.php b/workflow/engine/methods/enterprise/addonsStore.php index a9d494aed..62b412c9c 100644 --- a/workflow/engine/methods/enterprise/addonsStore.php +++ b/workflow/engine/methods/enterprise/addonsStore.php @@ -9,7 +9,7 @@ $oHeadPublisher = &headPublisher::getSingleton(); if (isset($licenseManager->date) && is_array($licenseManager->date)) { $conf = new Configurations(); - if ( defined('SYS_SYS') && $conf->exists("ENVIRONMENT_SETTINGS")) { + if (!empty(config("system.workspace")) && $conf->exists("ENVIRONMENT_SETTINGS")) { $licenseManager->date['START'] = date("Y-m-d H:i:s", strtotime($licenseManager->date['HUMAN']['START'])); $licenseManager->date['END'] = date("Y-m-d H:i:s", strtotime($licenseManager->date['HUMAN']['END'])); $licenseManager->date['START'] = $conf->getSystemDate($licenseManager->date['START']); @@ -63,7 +63,7 @@ $oHeadPublisher->assign("supportStartDate", (isset($licenseManager->supportStart $oHeadPublisher->assign("supportEndDate", (isset($licenseManager->supportEndDate))? $licenseManager->supportEndDate : ''); $oHeadPublisher->assign("PROCESSMAKER_VERSION", System::getVersion()); -$oHeadPublisher->assign("PROCESSMAKER_URL", "/sys" . config("sys_sys") . "/" . SYS_LANG . "/" . SYS_SKIN ); +$oHeadPublisher->assign("PROCESSMAKER_URL", "/sys" . config("system.workspace") . "/" . SYS_LANG . "/" . SYS_SKIN ); $oHeadPublisher->assign("SYS_SKIN", SYS_SKIN); $oHeadPublisher->assign("URL_PART_LOGIN", ((substr(SYS_SKIN, 0, 2) == "ux" && SYS_SKIN != "uxs")? "main/login" : "login/login")); $oHeadPublisher->assign("URL_PART_SETUP", EnterpriseUtils::getUrlPartSetup()); diff --git a/workflow/engine/methods/enterprise/addonsStoreAction.php b/workflow/engine/methods/enterprise/addonsStoreAction.php index 970464401..0172149e2 100644 --- a/workflow/engine/methods/enterprise/addonsStoreAction.php +++ b/workflow/engine/methods/enterprise/addonsStoreAction.php @@ -160,7 +160,7 @@ try { } /////// - $workspace = config("sys_sys"); + $workspace = config("system.workspace"); $dbAdapter = DB_ADAPTER; $addon->setAddonState("download-start"); diff --git a/workflow/engine/methods/enterprise/enterprise.php b/workflow/engine/methods/enterprise/enterprise.php index f70b3f842..2501d8f78 100644 --- a/workflow/engine/methods/enterprise/enterprise.php +++ b/workflow/engine/methods/enterprise/enterprise.php @@ -8,7 +8,7 @@ if (!defined("PATH_PM_ENTERPRISE")) { } if (!defined("PATH_DATA_SITE")) { - define("PATH_DATA_SITE", PATH_DATA . "sites/" . config("sys_sys") . "/"); + define("PATH_DATA_SITE", PATH_DATA . "sites/" . config("system.workspace") . "/"); } set_include_path(PATH_PM_ENTERPRISE . PATH_SEPARATOR . get_include_path()); @@ -78,12 +78,12 @@ class enterprisePlugin extends PMPlugin unset($_SESSION["__EE_SW_PMLICENSEMANAGER__"]); /////// - $js = "window.open(\"/sys" . config("sys_sys") . "/" . SYS_LANG . "/" . SYS_SKIN . "/setup/main?s=PLUGINS\", \"_top\", \"\");"; + $js = "window.open(\"/sys" . config("system.workspace") . "/" . SYS_LANG . "/" . SYS_SKIN . "/setup/main?s=PLUGINS\", \"_top\", \"\");"; if (substr(SYS_SKIN, 0, 2) == "ux" && SYS_SKIN != "uxs") { - //$js = "parent.window.location.href = \"/sys" . config("sys_sys") . "/" . SYS_LANG . "/" . SYS_SKIN . "/setup/main_init?s=PLUGINS\";"; - //$js = "window.location.href = \"/sys" . config("sys_sys") . "/" . SYS_LANG . "/" . SYS_SKIN . "/setup/pluginsImport\";"; - $js = "window.open(\"/sys" . config("sys_sys") . "/" . SYS_LANG . "/" . SYS_SKIN . "/main\", \"_top\", \"\");"; + //$js = "parent.window.location.href = \"/sys" . config("system.workspace") . "/" . SYS_LANG . "/" . SYS_SKIN . "/setup/main_init?s=PLUGINS\";"; + //$js = "window.location.href = \"/sys" . config("system.workspace") . "/" . SYS_LANG . "/" . SYS_SKIN . "/setup/pluginsImport\";"; + $js = "window.open(\"/sys" . config("system.workspace") . "/" . SYS_LANG . "/" . SYS_SKIN . "/main\", \"_top\", \"\");"; } /////// diff --git a/workflow/engine/methods/enterprise/processMakerAjax.php b/workflow/engine/methods/enterprise/processMakerAjax.php index 594a0c03c..d68088a97 100644 --- a/workflow/engine/methods/enterprise/processMakerAjax.php +++ b/workflow/engine/methods/enterprise/processMakerAjax.php @@ -63,7 +63,7 @@ function install($file) $context = stream_context_create($option); /////// - $fileData = @fopen(EnterpriseUtils::getUrlServerName() . "/sys" . config("sys_sys") . "/" . SYS_LANG . "/" . SYS_SKIN . "/enterprise/services/processMakerUpgrade", "rb", false, $context); + $fileData = @fopen(EnterpriseUtils::getUrlServerName() . "/sys" . config("system.workspace") . "/" . SYS_LANG . "/" . SYS_SKIN . "/enterprise/services/processMakerUpgrade", "rb", false, $context); if ($fileData === false) { throw (new Exception("Could not open services url.")); diff --git a/workflow/engine/methods/login/authentication.php b/workflow/engine/methods/login/authentication.php index c2f6fc266..7333c57b9 100644 --- a/workflow/engine/methods/login/authentication.php +++ b/workflow/engine/methods/login/authentication.php @@ -146,7 +146,7 @@ try { $errLabel = G::LoadTranslation('ID_ACCOUNT') . ' "' . $usr . '" ' . G::LoadTranslation('ID_ACCOUNT_DISABLED_CONTACT_ADMIN'); } //Log failed authentications - $message = "| Many failed authentication attempts for USER: " . $usr . " | IP: " . G::getIpAddress() . " | WS: " . config("sys_sys"); + $message = "| Many failed authentication attempts for USER: " . $usr . " | IP: " . G::getIpAddress() . " | WS: " . config("system.workspace"); $message .= " | BROWSER: " . $_SERVER['HTTP_USER_AGENT']; G::log($message, PATH_DATA, 'loginFailed.log'); @@ -171,7 +171,7 @@ try { } if (!isset( $_SESSION['WORKSPACE'] ) ) { - $_SESSION['WORKSPACE'] = config("sys_sys"); + $_SESSION['WORKSPACE'] = config("system.workspace"); } //Execute the SSO Script from plugin @@ -248,7 +248,7 @@ try { $userTimeZone = $user->getUsrTimeZone(); if (trim($userTimeZone) == '') { - $arraySystemConfiguration = System::getSystemConfiguration('', '', config("sys_sys")); + $arraySystemConfiguration = System::getSystemConfiguration('', '', config("system.workspace")); $userTimeZone = $arraySystemConfiguration['time_zone']; } @@ -409,7 +409,7 @@ try { die; } - $configS = System::getSystemConfiguration('', '', config("sys_sys")); + $configS = System::getSystemConfiguration('', '', config("system.workspace")); $activeSession = isset($configS['session_block']) ? !(int)$configS['session_block']:true; if ($activeSession){ setcookie("PM-TabPrimary", 101010010, time() + (24 * 60 * 60), '/'); diff --git a/workflow/engine/methods/login/authenticationSso.php b/workflow/engine/methods/login/authenticationSso.php index 30e902e9e..a61ce62e6 100644 --- a/workflow/engine/methods/login/authenticationSso.php +++ b/workflow/engine/methods/login/authenticationSso.php @@ -20,7 +20,7 @@ try { } header( - 'Location: /sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . + 'Location: /sys' . config("system.workspace") . '/' . SYS_LANG . '/' . SYS_SKIN . '/login/login' . (($u != '')? '?u=' . $u : '') ); @@ -40,7 +40,7 @@ try { } /*----------------------------------********---------------------------------*/ - $arraySystemConfiguration = System::getSystemConfiguration('', '', config("sys_sys")); + $arraySystemConfiguration = System::getSystemConfiguration('', '', config("system.workspace")); //Set User Time Zone $user = UsersPeer::retrieveByPK($userUid); diff --git a/workflow/engine/methods/login/login.php b/workflow/engine/methods/login/login.php index 5c040d1e2..58abe4dc6 100644 --- a/workflow/engine/methods/login/login.php +++ b/workflow/engine/methods/login/login.php @@ -188,9 +188,9 @@ session_start(); session_regenerate_id(); if (PHP_VERSION < 5.2) { - setcookie("workspaceSkin", SYS_SKIN, time() + (24 * 60 * 60), "/sys" . config("sys_sys"), "; HttpOnly"); + setcookie("workspaceSkin", SYS_SKIN, time() + (24 * 60 * 60), "/sys" . config("system.workspace"), "; HttpOnly"); } else { - setcookie("workspaceSkin", SYS_SKIN, time() + (24 * 60 * 60), "/sys" . config("sys_sys"), null, false, true); + setcookie("workspaceSkin", SYS_SKIN, time() + (24 * 60 * 60), "/sys" . config("system.workspace"), null, false, true); } if (strlen($msg) > 0) { @@ -361,7 +361,7 @@ $flagForgotPassword = isset($oConf->aConfig['login_enableForgotPassword']) setcookie('PM-Warning', trim(G::LoadTranslation('ID_BLOCKER_MSG'), '*'), time() + (24 * 60 * 60), SYS_URI); -$configS = System::getSystemConfiguration('', '', config("sys_sys")); +$configS = System::getSystemConfiguration('', '', config("system.workspace")); $activeSession = isset($configS['session_block']) ? !(int)$configS['session_block'] : true; if ($activeSession) { setcookie("PM-TabPrimary", 101010010, time() + (24 * 60 * 60), '/'); diff --git a/workflow/engine/methods/oauth2/grant.php b/workflow/engine/methods/oauth2/grant.php index f3760503e..0fa32f861 100644 --- a/workflow/engine/methods/oauth2/grant.php +++ b/workflow/engine/methods/oauth2/grant.php @@ -9,7 +9,7 @@ if (! empty($_GET['error'])) { $http = G::is_https() ? 'https' : 'http'; $host = $_SERVER['SERVER_NAME'] . ($_SERVER['SERVER_PORT'] != '80' ? ':' . $_SERVER['SERVER_PORT'] : ''); -$endpoint = sprintf('%s://%s/%s/oauth2/token', $http, $host, config("sys_sys")); +$endpoint = sprintf('%s://%s/%s/oauth2/token', $http, $host, config("system.workspace")); $code = empty($_GET['code']) ? 'NN' : $_GET['code']; $clientId = 'x-pm-local-client'; diff --git a/workflow/engine/methods/processes/consolidated.php b/workflow/engine/methods/processes/consolidated.php index 8439d9ad5..ac7840550 100644 --- a/workflow/engine/methods/processes/consolidated.php +++ b/workflow/engine/methods/processes/consolidated.php @@ -19,7 +19,7 @@ class AdditionalTablesConsolidated extends AdditionalTables $sClassName = $this->getPHPName($sTableName); } - $sPath = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; + $sPath = PATH_DB . config("system.workspace") . PATH_SEP . 'classes' . PATH_SEP; if (!file_exists($sPath)) { G::mk_dir($sPath); G::mk_dir($sPath . 'map'); @@ -626,7 +626,7 @@ class ajax_con extends WebResource $oAdditionalTables->createPropelClasses($tableName, $sClassName, $aFieldsClases, $sTasUid); } else { - $sPath = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; + $sPath = PATH_DB . config("system.workspace") . PATH_SEP . 'classes' . PATH_SEP; @unlink($sPath . $sClassName . '.php'); @unlink($sPath . $sClassName . 'Peer.php'); @unlink($sPath . PATH_SEP . 'map' . PATH_SEP . $sClassName . 'MapBuilder.php'); diff --git a/workflow/engine/methods/processes/mainInit.php b/workflow/engine/methods/processes/mainInit.php index 6ad7d9768..2253624e4 100644 --- a/workflow/engine/methods/processes/mainInit.php +++ b/workflow/engine/methods/processes/mainInit.php @@ -92,7 +92,7 @@ $oHeadPublisher->assign("arrayContextMenuOptionPlugin", $arrayContextMenuOptionP $oHeadPublisher->assign('extJsViewState', $oHeadPublisher->getExtJsViewState()); $designer = new Designer(); -$oHeadPublisher->assign('SYS_SYS', config("sys_sys")); +$oHeadPublisher->assign('SYS_SYS', config("system.workspace")); $oHeadPublisher->assign('SYS_LANG', SYS_LANG); $oHeadPublisher->assign('SYS_SKIN', SYS_SKIN); $oHeadPublisher->assign('HTTP_SERVER_HOSTNAME', System::getHttpServerHostnameRequestsFrontEnd()); diff --git a/workflow/engine/methods/processes/processesList.php b/workflow/engine/methods/processes/processesList.php index 72e600b56..51b0abcee 100644 --- a/workflow/engine/methods/processes/processesList.php +++ b/workflow/engine/methods/processes/processesList.php @@ -33,7 +33,7 @@ $oProcess = new Process(); $oProcess->dir = $dir; $oProcess->sort = $sort; -//$memcache = & PMmemcached::getSingleton( config("sys_sys") ); +//$memcache = & PMmemcached::getSingleton( config("system.workspace") ); $memkey = 'no memcache'; $memcacheUsed = 'not used'; diff --git a/workflow/engine/methods/processes/processes_Ajax.php b/workflow/engine/methods/processes/processes_Ajax.php index def886f80..15d991765 100644 --- a/workflow/engine/methods/processes/processes_Ajax.php +++ b/workflow/engine/methods/processes/processes_Ajax.php @@ -189,13 +189,13 @@ try { $filter = new InputFilter(); $form = $_REQUEST; - $filePath = PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP . "public" . PATH_SEP . $form['PRO_UID'] . PATH_SEP . $form['FILENAME']; + $filePath = PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP . "public" . PATH_SEP . $form['PRO_UID'] . PATH_SEP . $form['FILENAME']; if (file_exists($filePath)) { unlink($filter->validateInput($filePath, 'path')); $webEntry = new \ProcessMaker\BusinessModel\WebEntry(); $webEntry->deleteClassic($form['PRO_UID'], $filePath); } - $filePath = PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP . "public" . PATH_SEP . $form['PRO_UID'] . PATH_SEP . str_replace(".php", "Post", $form['FILENAME']) . ".php"; + $filePath = PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP . "public" . PATH_SEP . $form['PRO_UID'] . PATH_SEP . str_replace(".php", "Post", $form['FILENAME']) . ".php"; if (file_exists($filePath)) { unlink($filter->validateInput($filePath, 'path')); } @@ -900,8 +900,8 @@ try { $resultArray = array(); $proUid = isset($_REQUEST['PRO_UID']) ? $_REQUEST['PRO_UID'] : ''; $dynUid = isset($_REQUEST['DYN_UID']) ? $_REQUEST['DYN_UID'] : ''; - if (is_file(PATH_DATA . '/sites/' . config("sys_sys") . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml') && filesize(PATH_DATA . '/sites/' . config("sys_sys") . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml') > 0) { - $dyn = new DynaformHandler(PATH_DATA . '/sites/' . config("sys_sys") . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml'); + if (is_file(PATH_DATA . '/sites/' . config("system.workspace") . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml') && filesize(PATH_DATA . '/sites/' . config("system.workspace") . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml') > 0) { + $dyn = new DynaformHandler(PATH_DATA . '/sites/' . config("system.workspace") . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml'); $dynaformFields[] = $dyn->getFields(); } foreach ($dynaformFields as $aDynFormFields) { diff --git a/workflow/engine/methods/processes/processes_DownloadFile.php b/workflow/engine/methods/processes/processes_DownloadFile.php index 07b7fa299..68305d1c1 100644 --- a/workflow/engine/methods/processes/processes_DownloadFile.php +++ b/workflow/engine/methods/processes/processes_DownloadFile.php @@ -6,7 +6,7 @@ if (!isset($_GET["file_hash"])) { } $httpStream = new \ProcessMaker\Util\IO\HttpStream(); -$outputDir = PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP; +$outputDir = PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP; $fileName = urldecode(base64_decode($_GET["file_hash"])); $processFile = $outputDir . $fileName; diff --git a/workflow/engine/methods/processes/processes_Export.php b/workflow/engine/methods/processes/processes_Export.php index bf8eb90a8..f4fd9a6c3 100644 --- a/workflow/engine/methods/processes/processes_Export.php +++ b/workflow/engine/methods/processes/processes_Export.php @@ -24,7 +24,7 @@ use ProcessMaker\Util\Common; $response = new StdClass(); -$outputDir = PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP; +$outputDir = PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP; try { if(empty($_GET)){ diff --git a/workflow/engine/methods/processes/processes_Import_Ajax.php b/workflow/engine/methods/processes/processes_Import_Ajax.php index 57f818678..d4e7d84a1 100644 --- a/workflow/engine/methods/processes/processes_Import_Ajax.php +++ b/workflow/engine/methods/processes/processes_Import_Ajax.php @@ -70,7 +70,7 @@ if (PMLicensedFeatures::getSingleton()->verifyfeature("B0oWlBLY3hHdWY0YUNpZEtFQm if (!empty($arrayTrigger)) { - $cs = new CodeScanner(config("sys_sys")); + $cs = new CodeScanner(config("system.workspace")); $strFoundDisabledCode = ""; diff --git a/workflow/engine/methods/processes/processes_webEntryGenerate.php b/workflow/engine/methods/processes/processes_webEntryGenerate.php index d3008c1e4..7bce76c1b 100644 --- a/workflow/engine/methods/processes/processes_webEntryGenerate.php +++ b/workflow/engine/methods/processes/processes_webEntryGenerate.php @@ -68,8 +68,8 @@ try { $pluginTpl = PATH_CORE . 'templates' . PATH_SEP . 'processes' . PATH_SEP . 'webentryPost.tpl'; $template = new TemplatePower( $pluginTpl ); $template->prepare(); - $template->assign( 'wsdlUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2' ); - $template->assign( 'wsUploadUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/upload' ); + $template->assign( 'wsdlUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . config("system.workspace") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2' ); + $template->assign( 'wsUploadUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . config("system.workspace") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/upload' ); $template->assign( 'processUid', $sPRO_UID ); $template->assign( 'dynaformUid', $sDYNAFORM ); $template->assign( 'taskUid', $sTASKS ); @@ -88,7 +88,7 @@ try { $template->assign( 'dynaform', $dynTitle ); $template->assign( 'timestamp', date( 'l jS \of F Y h:i:s A' ) ); - $template->assign( 'ws', config("sys_sys") ); + $template->assign( 'ws', config("system.workspace") ); $template->assign( 'version', System::getVersion() ); $fileName = $pathProcess . $dynTitle . 'Post.php'; @@ -134,13 +134,13 @@ try { $aDataEvent['EVN_CONDITIONS'] = $sWS_USER; $output = $oEvent->update( $aDataEvent ); //Show link - $link = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $sPRO_UID . '/' . $dynTitle . '.php'; + $link = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("system.workspace") . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $sPRO_UID . '/' . $dynTitle . '.php'; print $link; //print "\n $link "; } else { $G_FORM = new Form( $sPRO_UID . '/' . $sDYNAFORM, PATH_DYNAFORM, SYS_LANG, false ); - $G_FORM->action = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/cases_StartExternal.php'; + $G_FORM->action = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("system.workspace") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/cases_StartExternal.php'; $scriptCode = ''; $scriptCode = $G_FORM->render( PATH_CORE . 'templates/' . 'xmlform' . '.html', $scriptCode ); @@ -158,7 +158,7 @@ try { $template->assign("URL_MABORAK_JS", G::browserCacheFilesUrl("/js/maborak/core/maborak.js")); $template->assign("URL_TRANSLATION_ENV_JS", G::browserCacheFilesUrl("/jscore/labels/" . SYS_LANG . ".js")); $template->assign("siteUrl", $http . $_SERVER["HTTP_HOST"]); - $template->assign("sysSys", config("sys_sys")); + $template->assign("sysSys", config("system.workspace")); $template->assign("sysLang", SYS_LANG); $template->assign("sysSkin", SYS_SKIN); $template->assign("processUid", $sPRO_UID); diff --git a/workflow/engine/methods/processes/processes_webEntryValidate.php b/workflow/engine/methods/processes/processes_webEntryValidate.php index c4056cd20..5f8df8d22 100644 --- a/workflow/engine/methods/processes/processes_webEntryValidate.php +++ b/workflow/engine/methods/processes/processes_webEntryValidate.php @@ -29,7 +29,7 @@ if (G::is_https()) { $http = 'http://'; } -$endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; +$endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("system.workspace") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; $client = new SoapClient( $endpoint, $streamContext ); $user = $sWS_USER; diff --git a/workflow/engine/methods/processes/webEntry_Val_Assig.php b/workflow/engine/methods/processes/webEntry_Val_Assig.php index ae813ecc4..c1b0ec0ea 100644 --- a/workflow/engine/methods/processes/webEntry_Val_Assig.php +++ b/workflow/engine/methods/processes/webEntry_Val_Assig.php @@ -14,7 +14,7 @@ if (G::is_https()) else $http = 'http://'; -$endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; +$endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("system.workspace") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; @$client = new SoapClient( $endpoint ); $oTask = new Task(); diff --git a/workflow/engine/methods/services/webdav.php b/workflow/engine/methods/services/webdav.php index 9c7ef8e7c..a98a04e6e 100644 --- a/workflow/engine/methods/services/webdav.php +++ b/workflow/engine/methods/services/webdav.php @@ -37,7 +37,7 @@ function AuthenticationBasicHTTP ($realm) return false; } -$realm = 'ProcessMaker Filesystem for Workspace ' . config("sys_sys"); +$realm = 'ProcessMaker Filesystem for Workspace ' . config("system.workspace"); # Choice an authentification type Digest or Basic //AuthenticationDigestHTTP($realm, $users, $phpcgi); diff --git a/workflow/engine/methods/services/wsdl2.php b/workflow/engine/methods/services/wsdl2.php index 29128f327..db14b1b91 100644 --- a/workflow/engine/methods/services/wsdl2.php +++ b/workflow/engine/methods/services/wsdl2.php @@ -6,7 +6,7 @@ $content = file_get_contents($filewsdl); $http = G::is_https() ? 'https' : 'http'; $port = $_SERVER['SERVER_PORT'] === '80' ? '' : ':' . $_SERVER['SERVER_PORT']; $lang = defined('SYS_LANG') ? SYS_LANG : 'en'; -$endpoint = $http . '://' . $_SERVER['SERVER_NAME'] . $port . '/sys' . config("sys_sys") . '/' . $lang . '/neoclassic/services/soap2'; +$endpoint = $http . '://' . $_SERVER['SERVER_NAME'] . $port . '/sys' . config("system.workspace") . '/' . $lang . '/neoclassic/services/soap2'; $content = str_replace("___SOAP_ADDRESS___", $endpoint, $content); diff --git a/workflow/engine/methods/setup/auditLogAjax.php b/workflow/engine/methods/setup/auditLogAjax.php index c54fe5487..c344e7277 100644 --- a/workflow/engine/methods/setup/auditLogAjax.php +++ b/workflow/engine/methods/setup/auditLogAjax.php @@ -110,7 +110,7 @@ $response = array (); switch ($option) { case "LST": $pageSize = $_REQUEST["pageSize"]; - $workspace = config("sys_sys"); + $workspace = config("system.workspace"); $action = $_REQUEST["action"]; $description = $_REQUEST["description"]; $dateFrom = $_REQUEST["dateFrom"]; diff --git a/workflow/engine/methods/setup/cronAjax.php b/workflow/engine/methods/setup/cronAjax.php index 801c7eff4..a0dcc40a1 100644 --- a/workflow/engine/methods/setup/cronAjax.php +++ b/workflow/engine/methods/setup/cronAjax.php @@ -116,7 +116,7 @@ $response = array (); switch ($option) { case "LST": $pageSize = $_REQUEST["pageSize"]; - $workspace = config("sys_sys"); + $workspace = config("system.workspace"); $status = $_REQUEST["status"]; $dateFrom = $_REQUEST["dateFrom"]; $dateTo = $_REQUEST["dateTo"]; diff --git a/workflow/engine/methods/setup/languages_Import.php b/workflow/engine/methods/setup/languages_Import.php index cceae2892..79df5581b 100644 --- a/workflow/engine/methods/setup/languages_Import.php +++ b/workflow/engine/methods/setup/languages_Import.php @@ -78,7 +78,7 @@ try { $configuration = new Configurations(); $importResults = $language->import( $languageFile ); - $renegerateContent = new WorkspaceTools( config("sys_sys") ); + $renegerateContent = new WorkspaceTools( config("system.workspace") ); $messs = $renegerateContent->upgradeContent(); $result->msg = G::LoadTranslation( 'IMPORT_LANGUAGE_SUCCESS' ) . "\n"; diff --git a/workflow/engine/methods/setup/loginSettingsAjax.php b/workflow/engine/methods/setup/loginSettingsAjax.php index 83a375f31..e30e75498 100644 --- a/workflow/engine/methods/setup/loginSettingsAjax.php +++ b/workflow/engine/methods/setup/loginSettingsAjax.php @@ -19,7 +19,7 @@ switch ($request) { print (G::json_encode( $result )) ; break; case 'saveSettings': - $memcache = & PMmemcached::getSingleton( defined( 'SYS_SYS' ) ? config("sys_sys") : '' ); + $memcache = & PMmemcached::getSingleton( !empty(config("system.workspace")) ? config("system.workspace") : '' ); $conf = new Configurations(); $conf->loadConfig( $obj, 'ENVIRONMENT_SETTINGS', '' ); diff --git a/workflow/engine/methods/setup/pluginsChange.php b/workflow/engine/methods/setup/pluginsChange.php index df10a45ad..fae89fef1 100644 --- a/workflow/engine/methods/setup/pluginsChange.php +++ b/workflow/engine/methods/setup/pluginsChange.php @@ -56,7 +56,7 @@ if ($handle = opendir(PATH_PLUGINS)) { ) { //Check disabled code - $cs = new CodeScanner(config("sys_sys")); + $cs = new CodeScanner(config("system.workspace")); $arrayFoundDisabledCode = array_merge( $cs->checkDisabledCode("FILE", PATH_PLUGINS . $pluginName . ".php"), diff --git a/workflow/engine/methods/setup/pluginsImportFile.php b/workflow/engine/methods/setup/pluginsImportFile.php index 863bb3f07..6a194a737 100644 --- a/workflow/engine/methods/setup/pluginsImportFile.php +++ b/workflow/engine/methods/setup/pluginsImportFile.php @@ -251,7 +251,7 @@ try { if (PMLicensedFeatures::getSingleton()->verifyfeature("B0oWlBLY3hHdWY0YUNpZEtFQm5CeTJhQlIwN3IxMEkwaG4=")) { //Check disabled code - $cs = new CodeScanner(config("sys_sys")); + $cs = new CodeScanner(config("system.workspace")); $arrayFoundDisabledCode = array_merge($cs->checkDisabledCode("FILE", $path . $pluginFile), $cs->checkDisabledCode("PATH", $path . $sClassName)); diff --git a/workflow/engine/methods/setup/pluginsList.php b/workflow/engine/methods/setup/pluginsList.php index 19aac663e..7890039cd 100644 --- a/workflow/engine/methods/setup/pluginsList.php +++ b/workflow/engine/methods/setup/pluginsList.php @@ -24,5 +24,5 @@ */ $RBAC->requirePermissions('PM_SETUP_ADVANCE'); -$items = \PMPlugin::getListPluginsManager(config("sys_sys")); +$items = \PMPlugin::getListPluginsManager(config("system.workspace")); echo G::json_encode($items); diff --git a/workflow/engine/methods/setup/pluginsMain.php b/workflow/engine/methods/setup/pluginsMain.php index f7ef645e1..8d43fd7e7 100644 --- a/workflow/engine/methods/setup/pluginsMain.php +++ b/workflow/engine/methods/setup/pluginsMain.php @@ -30,7 +30,7 @@ $RBAC->requirePermissions( 'PM_SETUP' ); $headPublisher = & headPublisher::getSingleton(); $headPublisher->addExtJsScript( 'setup/pluginsMain', false ); -$headPublisher->assign( "PROCESSMAKER_URL", "/sys" . config("sys_sys") . "/" . SYS_LANG . "/" . SYS_SKIN ); +$headPublisher->assign( "PROCESSMAKER_URL", "/sys" . config("system.workspace") . "/" . SYS_LANG . "/" . SYS_SKIN ); $headPublisher->assign( "SYS_SKIN", SYS_SKIN ); $oPluginRegistry = PluginRegistry::loadSingleton(); diff --git a/workflow/engine/methods/setup/replacementLogo.php b/workflow/engine/methods/setup/replacementLogo.php index 7f3318c2b..ac15b9d6d 100644 --- a/workflow/engine/methods/setup/replacementLogo.php +++ b/workflow/engine/methods/setup/replacementLogo.php @@ -63,7 +63,7 @@ try { //ini_set('display_errors','1'); $snameLogo = changeNamelogo( $snameLogo ); $oConf = new Configurations(); - $aConf = Array ('WORKSPACE_LOGO_NAME' => config("sys_sys"),'DEFAULT_LOGO_NAME' => $snameLogo + $aConf = Array ('WORKSPACE_LOGO_NAME' => config("system.workspace"),'DEFAULT_LOGO_NAME' => $snameLogo ); $oConf->aConfig = $aConf; diff --git a/workflow/engine/methods/setup/skin_Ajax.php b/workflow/engine/methods/setup/skin_Ajax.php index 8c07bdca6..d939fac45 100644 --- a/workflow/engine/methods/setup/skin_Ajax.php +++ b/workflow/engine/methods/setup/skin_Ajax.php @@ -162,7 +162,7 @@ function newSkin ($baseSkin = 'classic') $xmlConfiguration = file_get_contents( $configFileOriginal ); - $workspace = ($_REQUEST['workspace'] == 'global') ? '' : config("sys_sys"); + $workspace = ($_REQUEST['workspace'] == 'global') ? '' : config("system.workspace"); $xmlConfigurationObj = G::xmlParser($xmlConfiguration); $skinInformationArray = $xmlConfigurationObj->result["skinConfiguration"]["__CONTENT__"]["information"]["__CONTENT__"]; @@ -282,7 +282,7 @@ function importSkin () $configFileFinal = PATH_CUSTOM_SKINS . $skinName . PATH_SEP . 'config.xml'; $xmlConfiguration = file_get_contents( $configFileOriginal ); - $workspace = ($_REQUEST['workspace'] == 'global') ? '' : config("sys_sys"); + $workspace = ($_REQUEST['workspace'] == 'global') ? '' : config("system.workspace"); $xmlConfigurationObj = G::xmlParser($xmlConfiguration); $skinInformationArray = $xmlConfigurationObj->result["skinConfiguration"]["__CONTENT__"]["information"]["__CONTENT__"]; diff --git a/workflow/engine/methods/setup/skinsList.php b/workflow/engine/methods/setup/skinsList.php index 5c81e9ffa..eba70dcf1 100644 --- a/workflow/engine/methods/setup/skinsList.php +++ b/workflow/engine/methods/setup/skinsList.php @@ -44,7 +44,7 @@ $oHeadPublisher->addExtJsScript( 'setup/skinList', false ); //adding a javascrip $oHeadPublisher->addContent( 'setup/skinList' ); //adding a html file .html. $oHeadPublisher->assign( 'CONFIG', $Config ); $oHeadPublisher->assign( 'SYS_SKIN', SYS_SKIN ); -$oHeadPublisher->assign( 'SYS_SYS', "sys".config("sys_sys") ); +$oHeadPublisher->assign( 'SYS_SYS', "sys".config("system.workspace") ); $oHeadPublisher->assign( 'FORMATS', $c->getFormats() ); diff --git a/workflow/engine/methods/setup/webServicesAjax.php b/workflow/engine/methods/setup/webServicesAjax.php index 49e4315d7..f99110713 100644 --- a/workflow/engine/methods/setup/webServicesAjax.php +++ b/workflow/engine/methods/setup/webServicesAjax.php @@ -66,7 +66,7 @@ switch ($_POST['action']) { if (! isset( $_SESSION['END_POINT'] )) { $aFields['WS_HOST'] = $_SERVER['HTTP_HOST']; - $aFields['WS_WORKSPACE'] = config("sys_sys"); + $aFields['WS_WORKSPACE'] = config("system.workspace"); } else { if (strpos( $_SESSION['END_POINT'], 'https' ) !== false) { preg_match( '@^(?:https://)?([^/]+)@i', $_SESSION['END_POINT'], $coincidencias ); @@ -94,15 +94,15 @@ switch ($_POST['action']) { $_SESSION['_DBArray'] = $_DBArray; if (! isset( $_SESSION['END_POINT'] )) { - //$wsdl = 'http://'.$_SERVER['HTTP_HOST'].'/sys'.config("sys_sys"). '/'. SYS_LANG .'/classic/services/wsdl'; + //$wsdl = 'http://'.$_SERVER['HTTP_HOST'].'/sys'.config("system.workspace"). '/'. SYS_LANG .'/classic/services/wsdl'; $wsdl = 'http://' . $_SERVER['HTTP_HOST']; - $workspace = config("sys_sys"); + $workspace = config("system.workspace"); } else { $wsdl = $_SESSION['END_POINT']; $workspace = $_SESSION['WS_WORKSPACE']; } - $defaultEndpoint = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/classic/services/wsdl2'; + $defaultEndpoint = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/sys' . config("system.workspace") . '/' . SYS_LANG . '/classic/services/wsdl2'; $wsdl = isset( $_SESSION['END_POINT'] ) ? $_SESSION['END_POINT'] : $defaultEndpoint; @@ -144,7 +144,7 @@ try { if (isset( $_POST["epr"] )) { $_SESSION['END_POINT'] = $_POST["epr"]; } - $defaultEndpoint = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/classic/services/wsdl2'; + $defaultEndpoint = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/sys' . config("system.workspace") . '/' . SYS_LANG . '/classic/services/wsdl2'; $endpoint = isset( $_SESSION['END_POINT'] ) ? $_SESSION['END_POINT'] : $defaultEndpoint; @@ -616,7 +616,7 @@ try { $caseNumber = $oCases->getAppNumber(); // generating the path for the template msj - $templateFile = PATH_DB . config("sys_sys") . PATH_SEP . 'mailTemplates' . PATH_SEP . $proUid . PATH_SEP . 'tempTemplate.hml'; + $templateFile = PATH_DB . config("system.workspace") . PATH_SEP . 'mailTemplates' . PATH_SEP . $proUid . PATH_SEP . 'tempTemplate.hml'; // generating the file adding the msj variable $messageBody = "message for case: " . $caseNumber . "
" . $message; file_put_contents( $templateFile, $messageBody ); @@ -1461,7 +1461,7 @@ try { function sendFile ($FILENAME, $USR_UID, $APP_UID, $DEL_INDEX = 1, $DOC_UID = null, $title = null, $comment = null) { - $defaultEndpoint = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/classic/services/upload'; + $defaultEndpoint = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/sys' . config("system.workspace") . '/' . SYS_LANG . '/classic/services/upload'; $upload = isset( $_SESSION['END_POINT'] ) ? $_SESSION['END_POINT'] : $defaultEndpoint; $DOC_UID = ($DOC_UID != null) ? $DOC_UID : - 1; diff --git a/workflow/engine/methods/setup/webServicesSetup.php b/workflow/engine/methods/setup/webServicesSetup.php index 6a59b5aaa..fc6b05036 100644 --- a/workflow/engine/methods/setup/webServicesSetup.php +++ b/workflow/engine/methods/setup/webServicesSetup.php @@ -29,7 +29,7 @@ $ses = new DBSession( $dbc ); if (! isset( $_SESSION['END_POINT'] )) { $aFields['WS_HOST'] = $_SERVER['HTTP_HOST']; - $aFields['WS_WORKSPACE'] = config("sys_sys"); + $aFields['WS_WORKSPACE'] = config("system.workspace"); } else { if (strpos( $_SESSION['END_POINT'], 'https' ) !== false) { preg_match( '@^(?:https://)?([^/]+)@i', $_SESSION['END_POINT'], $coincidencias ); diff --git a/workflow/engine/methods/tracker/tracker_ShowDocument.php b/workflow/engine/methods/tracker/tracker_ShowDocument.php index 433258afe..b1a532ca1 100644 --- a/workflow/engine/methods/tracker/tracker_ShowDocument.php +++ b/workflow/engine/methods/tracker/tracker_ShowDocument.php @@ -65,8 +65,8 @@ if (! $sw_file_exists) { print G::json_encode( $res ); } else { G::SendMessageText( $error_message, "ERROR" ); - $backUrlObj = explode( "sys" . config("sys_sys"), $_SERVER['HTTP_REFERER'] ); - G::header( "location: " . "/sys" . config("sys_sys") . $backUrlObj[1] ); + $backUrlObj = explode( "sys" . config("system.workspace"), $_SERVER['HTTP_REFERER'] ); + G::header( "location: " . "/sys" . config("system.workspace") . $backUrlObj[1] ); die(); } diff --git a/workflow/engine/methods/tracker/tracker_ShowOutputDocument.php b/workflow/engine/methods/tracker/tracker_ShowOutputDocument.php index 7d85300ea..c3dc3bdd3 100644 --- a/workflow/engine/methods/tracker/tracker_ShowOutputDocument.php +++ b/workflow/engine/methods/tracker/tracker_ShowOutputDocument.php @@ -68,8 +68,8 @@ if (! $sw_file_exists) { print G::json_encode( $res ); } else { G::SendMessageText( $error_message, "ERROR" ); - $backUrlObj = explode( "sys" . config("sys_sys"), $_SERVER['HTTP_REFERER'] ); - G::header( "location: " . "/sys" . config("sys_sys") . $backUrlObj[1] ); + $backUrlObj = explode( "sys" . config("system.workspace"), $_SERVER['HTTP_REFERER'] ); + G::header( "location: " . "/sys" . config("system.workspace") . $backUrlObj[1] ); die(); } diff --git a/workflow/engine/methods/triggers/triggers_Save.php b/workflow/engine/methods/triggers/triggers_Save.php index 8499506a5..a08dbbfa4 100644 --- a/workflow/engine/methods/triggers/triggers_Save.php +++ b/workflow/engine/methods/triggers/triggers_Save.php @@ -61,7 +61,7 @@ if (isset( $sfunction ) && $sfunction == 'lookforNameTrigger') { ) { //Check disabled code - $cs = new CodeScanner(config("sys_sys")); + $cs = new CodeScanner(config("system.workspace")); $arrayFoundDisabledCode = $cs->checkDisabledCode("SOURCE", $value["TRI_WEBBOT"]); diff --git a/workflow/engine/methods/users/usersEdit.php b/workflow/engine/methods/users/usersEdit.php index 9117dead4..bb35d1412 100644 --- a/workflow/engine/methods/users/usersEdit.php +++ b/workflow/engine/methods/users/usersEdit.php @@ -33,7 +33,7 @@ if ($licensedFeatures->verifyfeature('w2LL3o4NFNiaDRXcFFCYVpJS3Jsall5dmh0ZWtBTkd } /*----------------------------------********---------------------------------*/ -$arraySystemConfiguration = System::getSystemConfiguration('', '', config("sys_sys")); +$arraySystemConfiguration = System::getSystemConfiguration('', '', config("system.workspace")); $oHeadPublisher = & headPublisher::getSingleton(); $oHeadPublisher->addExtJsScript( 'users/users', true ); //adding a javascript file .js diff --git a/workflow/engine/methods/users/usersInit.php b/workflow/engine/methods/users/usersInit.php index 4ef45d52a..5d2cb136f 100644 --- a/workflow/engine/methods/users/usersInit.php +++ b/workflow/engine/methods/users/usersInit.php @@ -48,7 +48,7 @@ if ($licensedFeatures->verifyfeature('w2LL3o4NFNiaDRXcFFCYVpJS3Jsall5dmh0ZWtBTkd } /*----------------------------------********---------------------------------*/ -$arraySystemConfiguration = System::getSystemConfiguration('', '', config("sys_sys")); +$arraySystemConfiguration = System::getSystemConfiguration('', '', config("system.workspace")); $oHeadPublisher = & headPublisher::getSingleton(); $oHeadPublisher->addExtJsScript( 'users/users', true ); //adding a javascript file .js diff --git a/workflow/engine/methods/users/usersNew.php b/workflow/engine/methods/users/usersNew.php index 6d65ea23e..ed48f5cea 100644 --- a/workflow/engine/methods/users/usersNew.php +++ b/workflow/engine/methods/users/usersNew.php @@ -38,7 +38,7 @@ if ($licensedFeatures->verifyfeature('w2LL3o4NFNiaDRXcFFCYVpJS3Jsall5dmh0ZWtBTkd } /*----------------------------------********---------------------------------*/ -$arraySystemConfiguration = System::getSystemConfiguration('', '', config("sys_sys")); +$arraySystemConfiguration = System::getSystemConfiguration('', '', config("system.workspace")); $oHeadPublisher = & headPublisher::getSingleton(); $oHeadPublisher->addExtJsScript( 'users/users', true ); //adding a javascript file .js diff --git a/workflow/engine/plugins/openFlash/class.openFlash.php b/workflow/engine/plugins/openFlash/class.openFlash.php index 6635599ed..18e5fc468 100644 --- a/workflow/engine/plugins/openFlash/class.openFlash.php +++ b/workflow/engine/plugins/openFlash/class.openFlash.php @@ -56,7 +56,7 @@ function getChart( $chartName ) { $this->readConfig(); - $prePath = '/sys' . config("sys_sys") . '/' . SYS_LANG . '/blank/'; + $prePath = '/sys' . config("system.workspace") . '/' . SYS_LANG . '/blank/'; $obj = new StdClass(); $obj->title = 'Standard ProcessMaker Reports'; $obj->height = 220; diff --git a/workflow/engine/plugins/pmosCommunity/class.pmosCommunity.php b/workflow/engine/plugins/pmosCommunity/class.pmosCommunity.php index 085ea2264..6b3b45dcd 100644 --- a/workflow/engine/plugins/pmosCommunity/class.pmosCommunity.php +++ b/workflow/engine/plugins/pmosCommunity/class.pmosCommunity.php @@ -56,7 +56,7 @@ function getChart( $chartName ) { $this->readConfig(); - $prePath = '/sys' . config("sys_sys") . '/' . SYS_LANG . '/blank/'; + $prePath = '/sys' . config("system.workspace") . '/' . SYS_LANG . '/blank/'; $obj = new StdClass(); switch ($chartName) { case 'PostByForum': diff --git a/workflow/engine/skinEngine/skinEngine.php b/workflow/engine/skinEngine/skinEngine.php index da6f21d2c..6aa861660 100644 --- a/workflow/engine/skinEngine/skinEngine.php +++ b/workflow/engine/skinEngine/skinEngine.php @@ -342,7 +342,7 @@ class SkinEngine } $smarty->assign('username', - (isset($_SESSION['USR_USERNAME']) ? '(' . $_SESSION['USR_USERNAME'] . ' ' . G::LoadTranslation('ID_IN') . ' ' . config("sys_sys") . ')' : '')); + (isset($_SESSION['USR_USERNAME']) ? '(' . $_SESSION['USR_USERNAME'] . ' ' . G::LoadTranslation('ID_IN') . ' ' . config("system.workspace") . ')' : '')); $smarty->assign('header', $header); $smarty->force_compile = $this->forceTemplateCompile; @@ -378,7 +378,7 @@ class SkinEngine $header = ''; if (isset($oHeadPublisher)) { - $oHeadPublisher->title = isset($_SESSION['USR_USERNAME']) ? '(' . $_SESSION['USR_USERNAME'] . ' ' . G::LoadTranslation('ID_IN') . ' ' . config("sys_sys") . ')' : ''; + $oHeadPublisher->title = isset($_SESSION['USR_USERNAME']) ? '(' . $_SESSION['USR_USERNAME'] . ' ' . G::LoadTranslation('ID_IN') . ' ' . config("system.workspace") . ')' : ''; $header = $oHeadPublisher->printHeader(); $header .= $oHeadPublisher->getExtJsStylesheets($this->cssFileName); } @@ -436,7 +436,7 @@ class SkinEngine $smarty->assign('rolename', isset($_SESSION['USR_ROLENAME']) ? $_SESSION['USR_ROLENAME'] . '' : ''); $smarty->assign('pipe', isset($_SESSION['USR_USERNAME']) ? ' | ' : ''); $smarty->assign('logout', G::LoadTranslation('ID_LOGOUT')); - $smarty->assign('workspace', defined('SYS_SYS') ? config("sys_sys") : ''); + $smarty->assign('workspace', !empty(config("system.workspace")) ? config("system.workspace") : ''); $uws = (isset($_SESSION['USR_ROLENAME']) && $_SESSION['USR_ROLENAME'] != '') ? strtolower(G::LoadTranslation('ID_WORKSPACE_USING')) : G::LoadTranslation('ID_WORKSPACE_USING'); $smarty->assign('workspace_label', $uws); @@ -448,8 +448,8 @@ class SkinEngine $smarty->assign('user', $name); } - if (defined('SYS_SYS')) { - $logout = '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/login/login'; + if (!empty(config("system.workspace"))) { + $logout = '/sys' . config("system.workspace") . '/' . SYS_LANG . '/' . SYS_SKIN . '/login/login'; } else { $logout = '/sys/' . SYS_LANG . '/' . SYS_SKIN . '/login/login'; } @@ -494,7 +494,7 @@ class SkinEngine $header = ''; if (isset($oHeadPublisher)) { - $oHeadPublisher->title = isset($_SESSION['USR_USERNAME']) ? '(' . $_SESSION['USR_USERNAME'] . ' ' . G::LoadTranslation('ID_IN') . ' ' . config("sys_sys") . ')' : ''; + $oHeadPublisher->title = isset($_SESSION['USR_USERNAME']) ? '(' . $_SESSION['USR_USERNAME'] . ' ' . G::LoadTranslation('ID_IN') . ' ' . config("system.workspace") . ')' : ''; $header = $oHeadPublisher->printHeader(); } @@ -694,8 +694,8 @@ class SkinEngine } if (isset($oHeadPublisher)) { - if (defined('SYS_SYS')) { - $oHeadPublisher->title = isset($_SESSION['USR_USERNAME']) ? '(' . $_SESSION['USR_USERNAME'] . ' ' . G::LoadTranslation('ID_IN') . ' ' . config("sys_sys") . ')' : ''; + if (!empty(config("system.workspace"))) { + $oHeadPublisher->title = isset($_SESSION['USR_USERNAME']) ? '(' . $_SESSION['USR_USERNAME'] . ' ' . G::LoadTranslation('ID_IN') . ' ' . config("system.workspace") . ')' : ''; } $header = $enableJsScript ? $oHeadPublisher->printHeader() : ''; $header .= $oHeadPublisher->getExtJsStylesheets($this->cssFileName); @@ -765,7 +765,7 @@ class SkinEngine $smarty->assign('rolename', isset($_SESSION['USR_ROLENAME']) ? $_SESSION['USR_ROLENAME'] . '' : ''); $smarty->assign('pipe', isset($_SESSION['USR_USERNAME']) ? ' | ' : ''); $smarty->assign('logout', G::LoadTranslation('ID_LOGOUT')); - $smarty->assign('workspace', defined('SYS_SYS') ? config("sys_sys") : ''); + $smarty->assign('workspace', !empty(config("system.workspace")) ? config("system.workspace") : ''); $uws = (isset($_SESSION['USR_ROLENAME']) && $_SESSION['USR_ROLENAME'] != '') ? strtolower(G::LoadTranslation('ID_WORKSPACE_USING')) : G::LoadTranslation('ID_WORKSPACE_USING'); $smarty->assign('workspace_label', $uws); @@ -777,7 +777,7 @@ class SkinEngine $smarty->assign('user', $name); } - if (defined('SYS_SYS')) { + if (!empty(config("system.workspace"))) { $pmLicenseManagerO = &PmLicenseManager::getSingleton(); $expireIn = $pmLicenseManagerO->getExpireIn(); $expireInLabel = $pmLicenseManagerO->getExpireInLabel(); @@ -793,8 +793,8 @@ class SkinEngine } } - if (defined('SYS_SYS')) { - $logout = "/sys" . config("sys_sys") . "/" . SYS_LANG . "/" . SYS_SKIN . ((SYS_COLLECTION != "tracker") ? "/login/login" : "/tracker/login"); + if (!empty(config("system.workspace"))) { + $logout = "/sys" . config("system.workspace") . "/" . SYS_LANG . "/" . SYS_SKIN . ((SYS_COLLECTION != "tracker") ? "/login/login" : "/tracker/login"); } else { $logout = '/sys/' . SYS_LANG . '/' . SYS_SKIN . '/login/login'; } @@ -806,7 +806,7 @@ class SkinEngine $oLogoR = new ReplacementLogo(); - if (defined("SYS_SYS")) { + if (!empty(config("system.workspace"))) { $aFotoSelect = $oLogoR->getNameLogo((isset($_SESSION['USER_LOGGED'])) ? $_SESSION['USER_LOGGED'] : ''); if (is_array($aFotoSelect)) { @@ -814,11 +814,11 @@ class SkinEngine $sWspaceSelect = trim($aFotoSelect['WORKSPACE_LOGO_NAME']); } } - if (class_exists('ProcessMaker\Plugins\PluginRegistry') && defined("SYS_SYS")) { + if (class_exists('ProcessMaker\Plugins\PluginRegistry') && !empty(config("system.workspace"))) { $oPluginRegistry = PluginRegistry::loadSingleton(); - if (isset($sFotoSelect) && $sFotoSelect != '' && !(strcmp($sWspaceSelect, config("sys_sys")))) { + if (isset($sFotoSelect) && $sFotoSelect != '' && !(strcmp($sWspaceSelect, config("system.workspace")))) { $sCompanyLogo = $oPluginRegistry->getCompanyLogo($sFotoSelect); - $sCompanyLogo = "/sys" . config("sys_sys") . "/" . SYS_LANG . "/" . SYS_SKIN . "/setup/showLogoFile.php?id=" . base64_encode($sCompanyLogo); + $sCompanyLogo = "/sys" . config("system.workspace") . "/" . SYS_LANG . "/" . SYS_SKIN . "/setup/showLogoFile.php?id=" . base64_encode($sCompanyLogo); } else { $sCompanyLogo = $oPluginRegistry->getCompanyLogo('/images/processmaker.logo.jpg'); } diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/ActionsByEmail.php b/workflow/engine/src/ProcessMaker/BusinessModel/ActionsByEmail.php index 7443c2e2d..e756f1935 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/ActionsByEmail.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/ActionsByEmail.php @@ -724,7 +724,7 @@ class ActionsByEmail if ($flagLogin) { header( - 'Location: /sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . + 'Location: /sys' . config("system.workspace") . '/' . SYS_LANG . '/' . SYS_SKIN . '/login/login?u=' . urlencode($_SERVER['REQUEST_URI']) ); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php b/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php index 12f6499ef..c94ed873b 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php @@ -3177,7 +3177,7 @@ class Cases } $arrayApplicationData['APP_DATA'][$key] = G::json_encode($files); } catch (Exception $e) { - Bootstrap::registerMonolog('DeleteFile', 400, $e->getMessage(), $value, config("sys_sys"), 'processmaker.log'); + Bootstrap::registerMonolog('DeleteFile', 400, $e->getMessage(), $value, config("system.workspace"), 'processmaker.log'); } } $flagDelete = true; diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Cases/InputDocument.php b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/InputDocument.php index 6eb951953..5dd4b5437 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Cases/InputDocument.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/InputDocument.php @@ -802,8 +802,8 @@ class InputDocument break; } G::SendMessageText( $message, "ERROR" ); - $backUrlObj = explode( "sys" . config("sys_sys"), $_SERVER['HTTP_REFERER'] ); - G::header( "location: " . "/sys" . config("sys_sys") . $backUrlObj[1] ); + $backUrlObj = explode( "sys" . config("system.workspace"), $_SERVER['HTTP_REFERER'] ); + G::header( "location: " . "/sys" . config("system.workspace") . $backUrlObj[1] ); die(); } @@ -855,9 +855,9 @@ class InputDocument if ($msg != '') { if ($runningWorkflow) { G::SendMessageText($msg, 'ERROR'); - $backUrlObj = explode('sys' . config("sys_sys"), $_SERVER['HTTP_REFERER']); + $backUrlObj = explode('sys' . config("system.workspace"), $_SERVER['HTTP_REFERER']); - G::header('location: ' . '/sys' . config("sys_sys") . $backUrlObj[1]); + G::header('location: ' . '/sys' . config("system.workspace") . $backUrlObj[1]); exit(0); } else { throw new Exception($msg); @@ -1005,8 +1005,8 @@ class InputDocument } $message = $res->message; G::SendMessageText($message, "ERROR"); - $backUrlObj = explode("sys" . config("sys_sys"), $_SERVER['HTTP_REFERER']); - G::header("location: " . "/sys" . config("sys_sys") . $backUrlObj[1]); + $backUrlObj = explode("sys" . config("system.workspace"), $_SERVER['HTTP_REFERER']); + G::header("location: " . "/sys" . config("system.workspace") . $backUrlObj[1]); die(); } @@ -1019,8 +1019,8 @@ class InputDocument if ($inpDocMaxFilesize > 0 && $fileSizeByField > 0) { if ($fileSizeByField > $inpDocMaxFilesize) { G::SendMessageText(G::LoadTranslation("ID_SIZE_VERY_LARGE_PERMITTED"), "ERROR"); - $arrayAux1 = explode("sys" . config("sys_sys"), $_SERVER["HTTP_REFERER"]); - G::header("location: /sys" . config("sys_sys") . $arrayAux1[1]); + $arrayAux1 = explode("sys" . config("system.workspace"), $_SERVER["HTTP_REFERER"]); + G::header("location: /sys" . config("system.workspace") . $arrayAux1[1]); exit(0); } } @@ -1035,8 +1035,8 @@ class InputDocument $message = G::LoadTranslation('THE_UPLOAD_OF_PHP_FILES_WAS_DISABLED'); Bootstrap::registerMonologPhpUploadExecution('phpUpload', 550, $message, 'processmaker.log'); G::SendMessageText($message, "ERROR"); - $backUrlObj = explode("sys" . config("sys_sys"), $_SERVER['HTTP_REFERER']); - G::header("location: " . "/sys" . config("sys_sys") . $backUrlObj[1]); + $backUrlObj = explode("sys" . config("system.workspace"), $_SERVER['HTTP_REFERER']); + G::header("location: " . "/sys" . config("system.workspace") . $backUrlObj[1]); die(); } diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Consolidated.php b/workflow/engine/src/ProcessMaker/BusinessModel/Consolidated.php index 38ae8f8d9..251ef33e5 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Consolidated.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Consolidated.php @@ -281,7 +281,7 @@ class Consolidated $className = $tableName; if (!class_exists($className)) { - require_once(PATH_DB . config("sys_sys") . PATH_SEP . "classes" . PATH_SEP . $className . ".php"); + require_once(PATH_DB . config("system.workspace") . PATH_SEP . "classes" . PATH_SEP . $className . ".php"); } $oCriteria = new Criteria("workflow"); @@ -908,7 +908,7 @@ class Consolidated } } - @unlink(PATH_C . "ws" . PATH_SEP . config("sys_sys") . PATH_SEP . "xmlform" . PATH_SEP . $pro_uid . PATH_SEP . $dyn_uid . "." . SYS_LANG); + @unlink(PATH_C . "ws" . PATH_SEP . config("system.workspace") . PATH_SEP . "xmlform" . PATH_SEP . $pro_uid . PATH_SEP . $dyn_uid . "." . SYS_LANG); $array ['columnModel'] = $caseColumns; diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/EmailEvent.php b/workflow/engine/src/ProcessMaker/BusinessModel/EmailEvent.php index 2edc1f423..9992308b0 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/EmailEvent.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/EmailEvent.php @@ -475,7 +475,7 @@ class EmailEvent \PMFSendMessage($appUID, $configEmailData['MESS_ACCOUNT'], $emailTo, '', '', $subject, $contentFile['prf_filename'], array(), array(), true, 0, $configEmailData); } else { - \Bootstrap::registerMonolog('EmailEventMailError', 200, \G::LoadTranslation('ID_EMAIL_EVENT_CONFIGURATION_EMAIL', array($eventUid, $prj_uid)), ['eventUid' => $eventUid, 'prj_uid' => $prj_uid], config("sys_sys"), 'processmaker.log'); + \Bootstrap::registerMonolog('EmailEventMailError', 200, \G::LoadTranslation('ID_EMAIL_EVENT_CONFIGURATION_EMAIL', array($eventUid, $prj_uid)), ['eventUid' => $eventUid, 'prj_uid' => $prj_uid], config("system.workspace"), 'processmaker.log'); } } } diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/EmailServer.php b/workflow/engine/src/ProcessMaker/BusinessModel/EmailServer.php index 3aac1c76a..a4d762bf9 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/EmailServer.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/EmailServer.php @@ -63,7 +63,7 @@ class EmailServer $currentUser = $RBAC->aUserInfo['USER_INFO']; $info = array( 'ip' => G::getIpAddress(), - 'workspace' => (defined("SYS_SYS")) ? config("sys_sys") : "Workspace undefined", + 'workspace' => (!empty(config("system.workspace"))) ? config("system.workspace") : "Workspace undefined", 'usrUid' => $currentUser['USR_UID'] ); $this->setContextLog($info); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Light.php b/workflow/engine/src/ProcessMaker/BusinessModel/Light.php index a5da9806b..22181737f 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Light.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Light.php @@ -328,7 +328,7 @@ class Light //Log Bootstrap::registerMonolog('MobileCreateCase', 200, "Create case", - ['application_uid' => $aData['APPLICATION'], 'usr_uid' => $userId], config("sys_sys"), 'processmaker.log'); + ['application_uid' => $aData['APPLICATION'], 'usr_uid' => $userId], config("system.workspace"), 'processmaker.log'); } catch (Exception $e) { $response['status'] = 'failure'; $response['message'] = $e->getMessage(); @@ -574,7 +574,7 @@ class Light //Log Bootstrap::registerMonolog('MobileRouteCase', 200, 'Route case', - ['application_uid' => $applicationUid, 'usr_uid' => $userUid], config("sys_sys"), 'processmaker.log'); + ['application_uid' => $applicationUid, 'usr_uid' => $userUid], config("system.workspace"), 'processmaker.log'); } catch (Exception $e) { throw $e; } @@ -807,7 +807,7 @@ class Light session_start(); session_regenerate_id(); - setcookie("workspaceSkin", SYS_SKIN, time() + (24 * 60 * 60), "/sys" . config("sys_sys"), null, false, true); + setcookie("workspaceSkin", SYS_SKIN, time() + (24 * 60 * 60), "/sys" . config("system.workspace"), null, false, true); if (strlen($msg) > 0) { $_SESSION['G_MESSAGE'] = $msg; @@ -1236,7 +1236,7 @@ class Light public function getUsersToReassign($usr_uid, $task_uid) { - $memcache = PMmemcached::getSingleton(config("sys_sys")); + $memcache = PMmemcached::getSingleton(config("system.workspace")); $RBAC = RBAC::getSingleton(PATH_DATA, session_id()); $RBAC->sSystem = 'PROCESSMAKER'; $RBAC->initRBAC(); @@ -1323,7 +1323,7 @@ class Light */ public function getConfiguration($params) { - $sysConf = Bootstrap::getSystemConfiguration('', '', config("sys_sys")); + $sysConf = Bootstrap::getSystemConfiguration('', '', config("system.workspace")); $multiTimeZone = false; //Set Time Zone /*----------------------------------********---------------------------------*/ diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Light/NotificationDevice.php b/workflow/engine/src/ProcessMaker/BusinessModel/Light/NotificationDevice.php index 392611994..4d0d8d99f 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Light/NotificationDevice.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Light/NotificationDevice.php @@ -12,7 +12,7 @@ class NotificationDevice public function checkMobileNotifications() { - $conf = System::getSystemConfiguration('', '', config("sys_sys")); + $conf = System::getSystemConfiguration('', '', config("system.workspace")); $activeNotifications = true; if (isset($conf['mobileNotifications'])) { $activeNotifications = $conf['mobileNotifications'] == 1 ? true : false; diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/MessageApplication.php b/workflow/engine/src/ProcessMaker/BusinessModel/MessageApplication.php index a0a649487..05d7b2931 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/MessageApplication.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/MessageApplication.php @@ -371,7 +371,7 @@ class MessageApplication $ws = new \WsBase(); $case = new \Cases(); $common = new \ProcessMaker\Util\Common(); - $sysSys = (defined("SYS_SYS"))? config("sys_sys") : "Undefined"; + $sysSys = (!empty(config("system.workspace")))? config("system.workspace") : "Undefined"; $common->setFrontEnd($frontEnd); @@ -683,7 +683,7 @@ class MessageApplication ) { try { - \Bootstrap::registerMonolog('MessageEventCron', $level, $message, $aContext, config("sys_sys"), 'processmaker.log'); + \Bootstrap::registerMonolog('MessageEventCron', $level, $message, $aContext, config("system.workspace"), 'processmaker.log'); } catch (\Exception $e) { throw $e; } diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/FileHandler.php b/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/FileHandler.php index f9e1ba397..de190c44c 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/FileHandler.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/FileHandler.php @@ -45,7 +45,7 @@ class FileHandler { $workflowFile = array(); $workspaceTargetDir = ($target === 'PUBLIC') ? 'public' : 'mailTemplates'; - $workspaceDir = PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP; + $workspaceDir = PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP; $templatesDir = $workspaceDir . $workspaceTargetDir . PATH_SEP . $prj_uid; $templatesFiles = Util\Common::rglob("$templatesDir/*", 0, true); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/FilesMigrator.php b/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/FilesMigrator.php index 5e1bf75c8..5c348fb34 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/FilesMigrator.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/FilesMigrator.php @@ -44,7 +44,7 @@ class FilesMigrator implements Importable, Exportable } $aPath = $data['PATH']; foreach ($aPath as $target => $files) { - $basePath = PATH_DATA . 'sites' . PATH_SEP . config("sys_sys") . PATH_SEP . 'public' . PATH_SEP; + $basePath = PATH_DATA . 'sites' . PATH_SEP . config("system.workspace") . PATH_SEP . 'public' . PATH_SEP; if (strtoupper($target) === 'PUBLIC') { foreach ($files as $file) { $filename = $basePath . ((isset($file["file_path"])) ? $file["file_path"] : $file["filepath"]); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/GranularExporter.php b/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/GranularExporter.php index d815bfe84..33b8d785d 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/GranularExporter.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/GranularExporter.php @@ -65,7 +65,7 @@ class GranularExporter $projectData = $bpmnProject->getProject(); $this->prjName = $projectData['PRJ_NAME']; $getProjectName = $this->publisher->truncateName($projectData['PRJ_NAME'], false); - $outputDir = PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP; + $outputDir = PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP; $version = Common::getLastVersionSpecialCharacters($outputDir, $getProjectName, "pmx2") + 1; $outputFilename = $outputDir . sprintf("%s-%s.%s", str_replace(" ", "_", $getProjectName), $version, "pmx2"); @@ -143,7 +143,7 @@ class GranularExporter "export_server_os" => PHP_OS , "export_server_php_version" => PHP_VERSION_ID, ); - $data["metadata"]["workspace"] = defined("SYS_SYS") ? config("sys_sys") : "Unknown"; + $data["metadata"]["workspace"] = !empty(config("system.workspace")) ? config("system.workspace") : "Unknown"; $data["metadata"]["name"] = $projectData['PRJ_NAME']; $data["metadata"]["uid"] = $projectData['PRJ_UID']; $data["metadata"]["export_version"] = $version; diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/TemplatesMigrator.php b/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/TemplatesMigrator.php index 5ba16f6d1..81971a218 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/TemplatesMigrator.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/TemplatesMigrator.php @@ -44,7 +44,7 @@ class TemplatesMigrator implements Importable, Exportable } $aPath = $data['PATH']; foreach ($aPath as $target => $files) { - $basePath = PATH_DATA . 'sites' . PATH_SEP . config("sys_sys") . PATH_SEP . 'mailTemplates' . PATH_SEP; + $basePath = PATH_DATA . 'sites' . PATH_SEP . config("system.workspace") . PATH_SEP . 'mailTemplates' . PATH_SEP; if (strtoupper($target) === 'TEMPLATE') { foreach ($files as $file) { $filename = $basePath . ((isset($file["file_path"])) ? $file["file_path"] : $file["filepath"]); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Process.php b/workflow/engine/src/ProcessMaker/BusinessModel/Process.php index 72a2cad01..d75e34c5e 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Process.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Process.php @@ -964,7 +964,7 @@ class Process $process = new \Process(); - $memcache = &\PMmemcached::getSingleton(config("sys_sys")); + $memcache = &\PMmemcached::getSingleton(config("system.workspace")); $memkey = "no memcache"; $memcacheUsed = "not used"; @@ -1775,8 +1775,8 @@ class Process $aInvalidTypes = array("title", "subtitle", "file", "button", "reset", "submit", "javascript"); $aMultipleSelectionFields = array("listbox", "checkgroup", "grid"); - if (is_file( PATH_DATA . '/sites/'. config("sys_sys") .'/xmlForms/'. $proUid .'/'.$dynUid. '.xml' ) && filesize( PATH_DATA . '/sites/'. config("sys_sys") .'/xmlForms/'. $proUid .'/'. $dynUid .'.xml' ) > 0) { - $dyn = new DynaformHandler( PATH_DATA . '/sites/'. config("sys_sys") .'/xmlForms/' .$proUid. '/' . $dynUid .'.xml' ); + if (is_file( PATH_DATA . '/sites/'. config("system.workspace") .'/xmlForms/'. $proUid .'/'.$dynUid. '.xml' ) && filesize( PATH_DATA . '/sites/'. config("system.workspace") .'/xmlForms/'. $proUid .'/'. $dynUid .'.xml' ) > 0) { + $dyn = new DynaformHandler( PATH_DATA . '/sites/'. config("system.workspace") .'/xmlForms/' .$proUid. '/' . $dynUid .'.xml' ); $dynaformFields[] = $dyn->getFields(); $fields = $dyn->getFields(); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/ProjectUser.php b/workflow/engine/src/ProcessMaker/BusinessModel/ProjectUser.php index 7db2ee01d..0c191b9ed 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/ProjectUser.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/ProjectUser.php @@ -227,7 +227,7 @@ class ProjectUser } else { $http = 'http://'; } - $endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; + $endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("system.workspace") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; @$client = new \SoapClient( $endpoint ); $user = $sWS_USER; $pass = $sWS_PASS; @@ -325,7 +325,7 @@ class ProjectUser try { $http = (\G::is_https())? "https://" : "http://"; - $client = new \SoapClient($http . $_SERVER["HTTP_HOST"] . "/sys" . config("sys_sys") . "/" . SYS_LANG . "/" . SYS_SKIN . "/services/wsdl2"); + $client = new \SoapClient($http . $_SERVER["HTTP_HOST"] . "/sys" . config("system.workspace") . "/" . SYS_LANG . "/" . SYS_SKIN . "/services/wsdl2"); $params = array( "userid" => $username, diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Skins.php b/workflow/engine/src/ProcessMaker/BusinessModel/Skins.php index dcbbc0beb..6ec0bc8aa 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Skins.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Skins.php @@ -99,7 +99,7 @@ class Skins $xmlConfiguration = file_get_contents($configFileOriginal); - $workspace = ($skinWorkspace == 'global') ? '' : config("sys_sys"); + $workspace = ($skinWorkspace == 'global') ? '' : config("system.workspace"); $xmlConfigurationObj = G::xmlParser($xmlConfiguration); $skinInformationArray = $xmlConfigurationObj->result["skinConfiguration"]["__CONTENT__"]["information"]["__CONTENT__"]; diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Table.php b/workflow/engine/src/ProcessMaker/BusinessModel/Table.php index 5b24829b0..0219b47c7 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Table.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Table.php @@ -592,7 +592,7 @@ class Table } $className = $table['ADD_TAB_CLASS_NAME']; $classPeerName = $className . 'Peer'; - $sPath = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; + $sPath = PATH_DB . config("system.workspace") . PATH_SEP . 'classes' . PATH_SEP; if (! file_exists( $sPath . $className . '.php' )) { throw new \Exception( 'Update:: ' . G::loadTranslation( 'ID_PMTABLE_CLASS_DOESNT_EXIST', $className ) ); } @@ -684,7 +684,7 @@ class Table } $className = $table['ADD_TAB_CLASS_NAME']; $classPeerName = $className . 'Peer'; - $sPath = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; + $sPath = PATH_DB . config("system.workspace") . PATH_SEP . 'classes' . PATH_SEP; if (! file_exists( $sPath . $className . '.php' )) { throw new \Exception( 'Update:: ' . G::loadTranslation( 'ID_PMTABLE_CLASS_DOESNT_EXIST', $className ) ); } diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/TimerEvent.php b/workflow/engine/src/ProcessMaker/BusinessModel/TimerEvent.php index 6e3445beb..fd2a4539e 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/TimerEvent.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/TimerEvent.php @@ -1151,7 +1151,7 @@ class TimerEvent private function log($action, $value = "", $status = "action") { try { - $workspace = (defined("SYS_SYS"))? config("sys_sys") : "Wokspace Undefined"; + $workspace = (!empty(config("system.workspace")))? config("system.workspace") : "Wokspace Undefined"; $ipClient = \G::getIpAddress(); $actionTimer = "timereventcron: "; @@ -1192,7 +1192,7 @@ class TimerEvent ) { try { - \Bootstrap::registerMonolog('TimerEventCron', $level, $message, $aContext, config("sys_sys"), 'processmaker.log'); + \Bootstrap::registerMonolog('TimerEventCron', $level, $message, $aContext, config("system.workspace"), 'processmaker.log'); } catch (\Exception $e) { throw $e; } @@ -1214,7 +1214,7 @@ class TimerEvent $ws = new \WsBase(); $case = new \Cases(); $common = new \ProcessMaker\Util\Common(); - $sysSys = (defined("SYS_SYS"))? config("sys_sys") : "Undefined"; + $sysSys = (!empty(config("system.workspace")))? config("system.workspace") : "Undefined"; $common->setFrontEnd($frontEnd); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Trigger.php b/workflow/engine/src/ProcessMaker/BusinessModel/Trigger.php index d792c06d2..1f54743fb 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Trigger.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Trigger.php @@ -171,7 +171,7 @@ class Trigger ) { //Check disabled code - $cs = new \CodeScanner(config("sys_sys")); + $cs = new \CodeScanner(config("system.workspace")); $arrayFoundDisabledCode = $cs->checkDisabledCode("SOURCE", $dataTrigger["TRI_WEBBOT"]); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/User.php b/workflow/engine/src/ProcessMaker/BusinessModel/User.php index c6b716b45..689cb371e 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/User.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/User.php @@ -719,7 +719,7 @@ class User $aUserProperty = $userProperty->loadOrCreateIfNotExists($userUid, array("USR_PASSWORD_HISTORY" => serialize(array(Bootstrap::hashPassword($arrayData["USR_PASSWORD"]))))); $memKey = "rbacSession" . session_id(); - $memcache = &PMmemcached::getSingleton(defined("SYS_SYS") ? config("sys_sys") : ""); + $memcache = &PMmemcached::getSingleton(!empty(config("system.workspace")) ? config("system.workspace") : ""); if (($rbac->aUserInfo = $memcache->get($memKey)) == false) { $rbac->loadUserRolePermission("PROCESSMAKER", $userUidLogged); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php index 207edb829..983a21f97 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php @@ -43,7 +43,7 @@ class WebEntry { $this->pathDataPublic = defined("PATH_DATA_PUBLIC") ? PATH_DATA_PUBLIC : \G::$pathDataPublic; $this->httpHost = isset($_SERVER["HTTP_HOST"]) ? $_SERVER["HTTP_HOST"] : \G::$httpHost; - $this->sysSys = defined("SYS_SYS") ? config("sys_sys") : \G::$sysSys; + $this->sysSys = !empty(config("system.workspace")) ? config("system.workspace") : \G::$sysSys; $this->sysSkin = defined("SYS_SKIN") ? SYS_SKIN : \G::$sysSkin; try { foreach ($this->arrayFieldDefinition as $key => $value) { @@ -851,7 +851,7 @@ class WebEntry try { if ((!isset($record['WE_LINK_GENERATION']) || $record['WE_LINK_GENERATION']==='DEFAULT') && $record["WE_METHOD"] == "WS") { $http = (\G::is_https())? "https://" : "http://"; - $url = $http . $_SERVER["HTTP_HOST"] . "/sys" . config("sys_sys") . "/" . SYS_LANG . "/" . SYS_SKIN . "/" . $record["PRO_UID"]; + $url = $http . $_SERVER["HTTP_HOST"] . "/sys" . config("system.workspace") . "/" . SYS_LANG . "/" . SYS_SKIN . "/" . $record["PRO_UID"]; $record["WE_DATA"] = $url . "/" . $record["WE_DATA"]; } diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEvent.php b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEvent.php index 5db7a1dbc..389b7186c 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEvent.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEvent.php @@ -1350,13 +1350,13 @@ class WebEntryEvent strpos($domain, 'https://') === 0; $url = ($hasProtocol ? '' : $http) . $domain . - "/sys" . config("sys_sys") . "/" . + "/sys" . config("system.workspace") . "/" . $weLinkLanguage . "/" . $weLinkSkin . "/" . $prj_uid; return $url . "/" . $weData; } else { - $url = $http . $_SERVER["HTTP_HOST"] . "/sys" . config("sys_sys") . "/" . SYS_LANG . "/" . SYS_SKIN . "/" . $prj_uid; + $url = $http . $_SERVER["HTTP_HOST"] . "/sys" . config("system.workspace") . "/" . SYS_LANG . "/" . SYS_SKIN . "/" . $prj_uid; return $url . "/" . $weData; } diff --git a/workflow/engine/src/ProcessMaker/Core/System.php b/workflow/engine/src/ProcessMaker/Core/System.php index bb475b7a4..55bd16502 100644 --- a/workflow/engine/src/ProcessMaker/Core/System.php +++ b/workflow/engine/src/ProcessMaker/Core/System.php @@ -1060,7 +1060,7 @@ class System $workspace = explode("|", $res['SKIN_WORKSPACE']); $swWS = false; foreach ($workspace as $key => $value) { - if ($value == config("sys_sys")) { + if ($value == config("system.workspace")) { $swWS = true; break; } diff --git a/workflow/engine/src/ProcessMaker/Exporter/Exporter.php b/workflow/engine/src/ProcessMaker/Exporter/Exporter.php index bb8357150..a22613946 100644 --- a/workflow/engine/src/ProcessMaker/Exporter/Exporter.php +++ b/workflow/engine/src/ProcessMaker/Exporter/Exporter.php @@ -92,7 +92,7 @@ abstract class Exporter $data = array(); $data["metadata"] = $this->getMetadata(); - $data["metadata"]["workspace"] = defined("SYS_SYS") ? config("sys_sys") : "Unknown"; + $data["metadata"]["workspace"] = !empty(config("system.workspace")) ? config("system.workspace") : "Unknown"; $data["metadata"]["name"] = $this->getProjectName(); $data["metadata"]["uid"] = $this->getProjectUid(); diff --git a/workflow/engine/src/ProcessMaker/Importer/Importer.php b/workflow/engine/src/ProcessMaker/Importer/Importer.php index d11527080..cf98c2e0e 100644 --- a/workflow/engine/src/ProcessMaker/Importer/Importer.php +++ b/workflow/engine/src/ProcessMaker/Importer/Importer.php @@ -771,7 +771,7 @@ abstract class Importer $exporter = new \ProcessMaker\Exporter\XmlExporter($prj_uid); $getProjectName = $exporter->truncateName($exporter->getProjectName(), false); - $outputDir = PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP; + $outputDir = PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP; $version = Common::getLastVersionSpecialCharacters($outputDir, $getProjectName, "pmx") + 1; $outputFilename = $outputDir . sprintf("%s-%s.%s", str_replace(" ", "_", $getProjectName), $version, "pmx"); diff --git a/workflow/engine/src/ProcessMaker/Plugins/PluginRegistry.php b/workflow/engine/src/ProcessMaker/Plugins/PluginRegistry.php index 00e2cf6b2..51d32f539 100644 --- a/workflow/engine/src/ProcessMaker/Plugins/PluginRegistry.php +++ b/workflow/engine/src/ProcessMaker/Plugins/PluginRegistry.php @@ -74,9 +74,9 @@ class PluginRegistry public static function loadSingleton() { if (self::$instance === null) { - if (is_null($object = Cache::get(config("sys_sys") . __CLASS__))) { + if (is_null($object = Cache::get(config("system.workspace") . __CLASS__))) { $object = new PluginRegistry(); - Cache::put(config("sys_sys") . __CLASS__, $object, config('app.cache_lifetime')); + Cache::put(config("system.workspace") . __CLASS__, $object, config('app.cache_lifetime')); } self::$instance = $object; } @@ -201,7 +201,7 @@ class PluginRegistry $fieldPlugin = PluginsRegistry::loadOrCreateIfNotExists(md5($plugin['PLUGIN_NAMESPACE']), $plugin); PluginsRegistry::update($fieldPlugin); } - Cache::pull(config("sys_sys") . __CLASS__); + Cache::pull(config("system.workspace") . __CLASS__); } /** * Get the plugin details, by filename diff --git a/workflow/engine/src/ProcessMaker/Project/Bpmn.php b/workflow/engine/src/ProcessMaker/Project/Bpmn.php index f856f9099..6900d487b 100644 --- a/workflow/engine/src/ProcessMaker/Project/Bpmn.php +++ b/workflow/engine/src/ProcessMaker/Project/Bpmn.php @@ -138,7 +138,7 @@ class Bpmn extends Handler //Define the variables for the logging $info = array( 'ip' => G::getIpAddress(), - 'workspace' => (defined("SYS_SYS"))? config("sys_sys") : "Workspace undefined" + 'workspace' => (!empty(config("system.workspace")))? config("system.workspace") : "Workspace undefined" ); $this->setContextLog($info); } diff --git a/workflow/engine/src/ProcessMaker/Project/Workflow.php b/workflow/engine/src/ProcessMaker/Project/Workflow.php index cc05c9dd2..1ac050db3 100644 --- a/workflow/engine/src/ProcessMaker/Project/Workflow.php +++ b/workflow/engine/src/ProcessMaker/Project/Workflow.php @@ -1123,10 +1123,10 @@ class Workflow extends Handler $basePath = PATH_DYNAFORM; break; case "PUBLIC": - $basePath = PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP . "public" . PATH_SEP; + $basePath = PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP . "public" . PATH_SEP; break; case "TEMPLATES": - $basePath = PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP . "mailTemplates" . PATH_SEP; + $basePath = PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP . "mailTemplates" . PATH_SEP; break; default: $basePath = ""; @@ -1213,7 +1213,7 @@ class Workflow extends Handler //Get templates and public files $workspaceTargetDirs = array("TEMPLATES" => "mailTemplates", "PUBLIC" => "public"); - $workspaceDir = PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP; + $workspaceDir = PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP; foreach ($workspaceTargetDirs as $target => $workspaceTargetDir) { $templatesDir = $workspaceDir . $workspaceTargetDir . PATH_SEP . $processUid; diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Project.php b/workflow/engine/src/ProcessMaker/Services/Api/Project.php index 855ae9ae0..ea6e887f7 100644 --- a/workflow/engine/src/ProcessMaker/Services/Api/Project.php +++ b/workflow/engine/src/ProcessMaker/Services/Api/Project.php @@ -189,7 +189,7 @@ class Project extends Api $objects = \G::json_decode($objects); $granularExporter = new GranularExporter($prj_uid); $outputFilename = $granularExporter->export($objects); - $outputFilename = PATH_DATA . 'sites' . PATH_SEP . config("sys_sys") . PATH_SEP . 'files' . PATH_SEP . 'output' . + $outputFilename = PATH_DATA . 'sites' . PATH_SEP . config("system.workspace") . PATH_SEP . 'files' . PATH_SEP . 'output' . PATH_SEP . $outputFilename; $httpStream = new HttpStream(); $fileExtension = pathinfo($outputFilename, PATHINFO_EXTENSION); @@ -211,7 +211,7 @@ class Project extends Api $exporter = new \ProcessMaker\Exporter\XmlExporter($prj_uid); $getProjectName = $exporter->truncateName($exporter->getProjectName(), false); - $outputDir = PATH_DATA . "sites" . PATH_SEP . config("sys_sys") . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP; + $outputDir = PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP; $version = Common::getLastVersionSpecialCharacters($outputDir, $getProjectName, "pmx") + 1; $outputFilename = $outputDir . sprintf("%s-%s.%s", str_replace(" ", "_", $getProjectName), $version, "pmx"); diff --git a/workflow/engine/src/ProcessMaker/Services/OAuth2/Server.php b/workflow/engine/src/ProcessMaker/Services/OAuth2/Server.php index 63ab1b572..9269c4dc2 100644 --- a/workflow/engine/src/ProcessMaker/Services/OAuth2/Server.php +++ b/workflow/engine/src/ProcessMaker/Services/OAuth2/Server.php @@ -144,8 +144,8 @@ class Server implements iAuthenticate $host = $_SERVER['SERVER_NAME'] . ($_SERVER['SERVER_PORT'] != '80' ? ':' . $_SERVER['SERVER_PORT'] : ''); $host = $http .'://'. $host; - $applicationsLink = sprintf('%s/%s/oauth2/apps', $host, config("sys_sys")); - $authorizationLink = sprintf('%s/%s/oauth2/authorize?response_type=code&client_id=[the-client-id]&scope=*', $host, config("sys_sys")); + $applicationsLink = sprintf('%s/%s/oauth2/apps', $host, config("system.workspace")); + $authorizationLink = sprintf('%s/%s/oauth2/authorize?response_type=code&client_id=[the-client-id]&scope=*', $host, config("system.workspace")); $view = new \Maveriks\Pattern\Mvc\SmartyView(PATH_CORE . "templates/oauth2/index.html"); $view->assign('host', $host); @@ -180,7 +180,7 @@ class Server implements iAuthenticate $host = $http . '://' . $_SERVER['SERVER_NAME'] . ($_SERVER['SERVER_PORT'] != '80' ? ':' . $_SERVER['SERVER_PORT'] : ''); $redirect = urlencode($host.'/'.self::$workspace.$_SERVER['REQUEST_URI']); - $loginLink = sprintf('%s/sys%s/%s/%s/login/login?u=%s', $host, config("sys_sys"), SYS_LANG, SYS_SKIN, $redirect); + $loginLink = sprintf('%s/sys%s/%s/%s/login/login?u=%s', $host, config("system.workspace"), SYS_LANG, SYS_SKIN, $redirect); header('location: ' . $loginLink); die; } @@ -214,7 +214,7 @@ class Server implements iAuthenticate $view = new \Maveriks\Pattern\Mvc\SmartyView(PATH_CORE . "templates/oauth2/authorize.html"); $view->assign('user', $user); $view->assign('client', $client); - $view->assign('postUri', '/' . config("sys_sys") . '/oauth2/authorize?' . $_SERVER['QUERY_STRING']); + $view->assign('postUri', '/' . config("system.workspace") . '/oauth2/authorize?' . $_SERVER['QUERY_STRING']); $view->render(); exit(); } @@ -364,7 +364,7 @@ class Server implements iAuthenticate $userTimeZone = $user->getUsrTimeZone(); if (trim($userTimeZone) == '') { - $arraySystemConfiguration = System::getSystemConfiguration('', '', config("sys_sys")); + $arraySystemConfiguration = System::getSystemConfiguration('', '', config("system.workspace")); $userTimeZone = $arraySystemConfiguration['time_zone']; } diff --git a/workflow/engine/src/ProcessMaker/Util/FixReferencePath.php b/workflow/engine/src/ProcessMaker/Util/FixReferencePath.php index 90afc53a2..ce4614e5d 100644 --- a/workflow/engine/src/ProcessMaker/Util/FixReferencePath.php +++ b/workflow/engine/src/ProcessMaker/Util/FixReferencePath.php @@ -200,7 +200,7 @@ class FixReferencePath */ public function regeneratePropelClasses($repTabName, $className, $fields, $guid) { - $sourcePath = PATH_DB . config("sys_sys") . PATH_SEP . 'classes' . PATH_SEP; + $sourcePath = PATH_DB . config("system.workspace") . PATH_SEP . 'classes' . PATH_SEP; @unlink($sourcePath . $className . '.php'); @unlink($sourcePath . $className . 'Peer.php'); diff --git a/workflow/engine/src/ProcessMaker/Util/System.php b/workflow/engine/src/ProcessMaker/Util/System.php index c17efdaeb..dad2188b3 100644 --- a/workflow/engine/src/ProcessMaker/Util/System.php +++ b/workflow/engine/src/ProcessMaker/Util/System.php @@ -27,7 +27,7 @@ class System public static function getTimeZone() { try { - $arraySystemConfiguration = PmSystem::getSystemConfiguration('', '', config("sys_sys")); + $arraySystemConfiguration = PmSystem::getSystemConfiguration('', '', config("system.workspace")); //Return return $arraySystemConfiguration['time_zone']; diff --git a/workflow/engine/src/ProcessMaker/Util/helpers.php b/workflow/engine/src/ProcessMaker/Util/helpers.php index 02e82c322..38e948cc6 100644 --- a/workflow/engine/src/ProcessMaker/Util/helpers.php +++ b/workflow/engine/src/ProcessMaker/Util/helpers.php @@ -251,8 +251,8 @@ function getVarsGrid($proUid, $dynUid) $dynaformFields = array(); - if (is_file(PATH_DATA . '/sites/' . config("sys_sys") . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml') && filesize(PATH_DATA . '/sites/' . config("sys_sys") . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml') > 0) { - $dyn = new dynaFormHandler(PATH_DATA . '/sites/' . config("sys_sys") . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml'); + if (is_file(PATH_DATA . '/sites/' . config("system.workspace") . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml') && filesize(PATH_DATA . '/sites/' . config("system.workspace") . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml') > 0) { + $dyn = new dynaFormHandler(PATH_DATA . '/sites/' . config("system.workspace") . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml'); $dynaformFields[] = $dyn->getFields(); } diff --git a/workflow/engine/templates/setup/webServicesTree.php b/workflow/engine/templates/setup/webServicesTree.php index b5cf43553..b853d4991 100644 --- a/workflow/engine/templates/setup/webServicesTree.php +++ b/workflow/engine/templates/setup/webServicesTree.php @@ -38,16 +38,16 @@ if (isset ( $_GET ['x'] )) { } } else { if (! isset ( $_SESSION ['END_POINT'] )) { - //$wsdl = 'http://'.$_SERVER['HTTP_HOST'].'/sys'.config("sys_sys").'/en/classic/services/wsdl'; + //$wsdl = 'http://'.$_SERVER['HTTP_HOST'].'/sys'.config("system.workspace").'/en/classic/services/wsdl'; $wsdl = 'http://' . $_SERVER ['HTTP_HOST']; - $workspace = config("sys_sys"); + $workspace = config("system.workspace"); } else { $wsdl = $_SESSION ['END_POINT']; $workspace = $_SESSION ['WS_WORKSPACE']; } } -$defaultEndpoint = 'http://' . $_SERVER ['SERVER_NAME'] . ':' . $_SERVER ['SERVER_PORT'] . '/sys' . config("sys_sys") . '/en/classic/services/wsdl2'; +$defaultEndpoint = 'http://' . $_SERVER ['SERVER_NAME'] . ':' . $_SERVER ['SERVER_PORT'] . '/sys' . config("system.workspace") . '/en/classic/services/wsdl2'; $wsdl = isset ( $_SESSION ['END_POINT'] ) ? $_SESSION ['END_POINT'] : $defaultEndpoint; diff --git a/workflow/public_html/bootstrap.php b/workflow/public_html/bootstrap.php index ec894f64c..ceb789db8 100644 --- a/workflow/public_html/bootstrap.php +++ b/workflow/public_html/bootstrap.php @@ -332,7 +332,7 @@ use ProcessMaker\Plugins\PluginRegistry; define ( 'SYS_SYS' , SYS_TEMP ); // defining constant for workspace shared directory - define ( 'PATH_WORKSPACE' , PATH_DB . config("sys_sys") . PATH_SEP ); + define ( 'PATH_WORKSPACE' , PATH_DB . config("system.workspace") . PATH_SEP ); // including workspace shared classes -> particularlly for pmTables set_include_path(get_include_path() . PATH_SEPARATOR . PATH_WORKSPACE); } @@ -382,7 +382,7 @@ use ProcessMaker\Plugins\PluginRegistry; } // PM Paths DATA - define('PATH_DATA_SITE', PATH_DATA . 'sites/' . config("sys_sys") . '/'); + define('PATH_DATA_SITE', PATH_DATA . 'sites/' . config("system.workspace") . '/'); define('PATH_DOCUMENT', PATH_DATA_SITE . 'files/'); define('PATH_DATA_MAILTEMPLATES', PATH_DATA_SITE . 'mailTemplates/'); define('PATH_DATA_PUBLIC', PATH_DATA_SITE . 'public/'); @@ -394,7 +394,7 @@ use ProcessMaker\Plugins\PluginRegistry; define('SERVER_PORT', $_SERVER ['SERVER_PORT']); // create memcached singleton - $memcache = & PMmemcached::getSingleton(config("sys_sys")); + $memcache = & PMmemcached::getSingleton(config("system.workspace")); // verify configuration for rest service if ($isRestRequest) { @@ -439,7 +439,7 @@ use ProcessMaker\Plugins\PluginRegistry; // unified log file for all databases $logFile = PATH_DATA . 'log' . PATH_SEP . 'propel.log'; - $logger = Log::singleton('file', $logFile, 'wf ' . config("sys_sys"), null, PEAR_LOG_INFO); + $logger = Log::singleton('file', $logFile, 'wf ' . config("system.workspace"), null, PEAR_LOG_INFO); Propel::setLogger($logger); // log file for workflow database $con = Propel::getConnection('workflow'); @@ -573,13 +573,13 @@ use ProcessMaker\Plugins\PluginRegistry; } //redirect to login, if user changed the workspace in the URL - if (! $avoidChangedWorkspaceValidation && isset($_SESSION['WORKSPACE']) && $_SESSION['WORKSPACE'] != config("sys_sys")) { - $_SESSION['WORKSPACE'] = config("sys_sys"); + if (! $avoidChangedWorkspaceValidation && isset($_SESSION['WORKSPACE']) && $_SESSION['WORKSPACE'] != config("system.workspace")) { + $_SESSION['WORKSPACE'] = config("system.workspace"); G::SendTemporalMessage ('ID_USER_HAVENT_RIGHTS_SYSTEM', "error"); // verify if the current skin is a 'ux' variant $urlPart = substr(SYS_SKIN, 0, 2) == 'ux' && SYS_SKIN != 'uxs' ? '/main/login' : '/login/login'; - header('Location: /sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . $urlPart); + header('Location: /sys' . config("system.workspace") . '/' . SYS_LANG . '/' . SYS_SKIN . $urlPart); die; } diff --git a/workflow/public_html/sysGeneric.php b/workflow/public_html/sysGeneric.php index 5e01f1323..6fbd65b0e 100644 --- a/workflow/public_html/sysGeneric.php +++ b/workflow/public_html/sysGeneric.php @@ -39,8 +39,8 @@ function transactionLog($transactionName){ //Custom parameters - if(defined("SYS_SYS")){ - newrelic_add_custom_parameter ("workspace", config("sys_sys")); + if(!empty(config("system.workspace"))){ + newrelic_add_custom_parameter ("workspace", config("system.workspace")); } if(defined("SYS_LANG")){ newrelic_add_custom_parameter ("lang", SYS_LANG); @@ -65,8 +65,8 @@ function transactionLog($transactionName){ } //Show correct transaction name - if(defined("SYS_SYS")){ - newrelic_set_appname ("PM-".config("sys_sys").";$baseName"); + if(!empty(config("system.workspace"))){ + newrelic_set_appname ("PM-".config("system.workspace").";$baseName"); } if(defined("PATH_CORE")){ $transactionName=str_replace(PATH_CORE,"",$transactionName); @@ -584,10 +584,10 @@ if (defined( 'SYS_TEMP' ) && SYS_TEMP != '') { if (file_exists( $pathFile )) { require_once ($pathFile); define( 'SYS_SYS', SYS_TEMP ); - config(["sys_sys" => SYS_TEMP]); + config(["system.workspace" => SYS_TEMP]); // defining constant for workspace shared directory - define( 'PATH_WORKSPACE', PATH_DB . config("sys_sys") . PATH_SEP ); + define( 'PATH_WORKSPACE', PATH_DB . config("system.workspace") . PATH_SEP ); // including workspace shared classes -> particularlly for pmTables set_include_path( get_include_path() . PATH_SEPARATOR . PATH_WORKSPACE ); } else { @@ -638,7 +638,7 @@ if (defined( 'SYS_TEMP' ) && SYS_TEMP != '') { } // PM Paths DATA -define( 'PATH_DATA_SITE', PATH_DATA . 'sites/' . config("sys_sys") . '/' ); +define( 'PATH_DATA_SITE', PATH_DATA . 'sites/' . config("system.workspace") . '/' ); define( 'PATH_DOCUMENT', PATH_DATA_SITE . 'files/' ); define( 'PATH_DATA_MAILTEMPLATES', PATH_DATA_SITE . 'mailTemplates/' ); define( 'PATH_DATA_PUBLIC', PATH_DATA_SITE . 'public/' ); @@ -652,7 +652,7 @@ define( 'SERVER_PORT', $_SERVER['SERVER_PORT'] ); // create memcached singleton -$memcache = & PMmemcached::getSingleton( config("sys_sys") ); +$memcache = & PMmemcached::getSingleton( config("system.workspace") ); // load Plugins base class @@ -671,7 +671,7 @@ if (defined( 'DEBUG_SQL_LOG' ) && DEBUG_SQL_LOG) { // unified log file for all databases $logFile = PATH_DATA . 'log' . PATH_SEP . 'propel.log'; - $logger = Log::singleton( 'file', $logFile, 'wf ' . config("sys_sys"), null, PEAR_LOG_INFO ); + $logger = Log::singleton( 'file', $logFile, 'wf ' . config("system.workspace"), null, PEAR_LOG_INFO ); Propel::setLogger( $logger ); // log file for workflow database $con = Propel::getConnection( 'workflow' ); @@ -887,13 +887,13 @@ if (substr( SYS_COLLECTION, 0, 8 ) === 'gulliver') { } //redirect to login, if user changed the workspace in the URL -if (! $avoidChangedWorkspaceValidation && isset( $_SESSION['WORKSPACE'] ) && $_SESSION['WORKSPACE'] != config("sys_sys")) { - $_SESSION['WORKSPACE'] = config("sys_sys"); +if (! $avoidChangedWorkspaceValidation && isset( $_SESSION['WORKSPACE'] ) && $_SESSION['WORKSPACE'] != config("system.workspace")) { + $_SESSION['WORKSPACE'] = config("system.workspace"); Bootstrap::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', "error" ); // verify if the current skin is a 'ux' variant $urlPart = substr( SYS_SKIN, 0, 2 ) == 'ux' && SYS_SKIN != 'uxs' ? '/main/login' : '/login/login'; - header( 'Location: /sys' . config("sys_sys") . '/' . SYS_LANG . '/' . SYS_SKIN . $urlPart ); + header( 'Location: /sys' . config("system.workspace") . '/' . SYS_LANG . '/' . SYS_SKIN . $urlPart ); die(); } From c3f74fca4b9113ca5f794177063243ef7bbfe749 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Tue, 10 Oct 2017 12:41:15 -0400 Subject: [PATCH 33/85] HOR-3851 --- thirdparty/html2ps_pdf/config.inc.php | 1 - workflow/engine/PmBootstrap.php | 7 +++---- workflow/engine/methods/processes/processesList.php | 2 -- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/thirdparty/html2ps_pdf/config.inc.php b/thirdparty/html2ps_pdf/config.inc.php index 716dcb1e2..41c513cec 100644 --- a/thirdparty/html2ps_pdf/config.inc.php +++ b/thirdparty/html2ps_pdf/config.inc.php @@ -102,7 +102,6 @@ define('MAX_IMAGE_ROW_LEN',16); define('MAX_TRANSPARENT_IMAGE_ROW_LEN',16); define('CACHE_DIR', HTML2PS_DIR.'cache/'); -//define('OUTPUT_FILE_DIRECTORY', HTML2PS_DIR.'out/'.(!empty(config("system.workspace")) ? config("system.workspace") . '/' : '')); define('OUTPUT_FILE_DIRECTORY', PATH_OUTPUT_FILE_DIRECTORY); define('FPDF_PATH', HTML2PS_DIR.'fpdf/'); diff --git a/workflow/engine/PmBootstrap.php b/workflow/engine/PmBootstrap.php index 527d6c9a9..aa367ed0f 100644 --- a/workflow/engine/PmBootstrap.php +++ b/workflow/engine/PmBootstrap.php @@ -239,11 +239,10 @@ class PmBootstrap extends Bootstrap public function initPropel($sys = '') { if (empty($sys)) { - if (empty(config("system.workspace"))) { - throw new Exception("Error: Undefined syemtem env. constant 'SYS_SYS'"); - } - $sys = config("system.workspace"); + if (empty($sys)) { + throw new Exception("Error: Undefined system environment (workspace)."); + } } // setup propel definitions and logging diff --git a/workflow/engine/methods/processes/processesList.php b/workflow/engine/methods/processes/processesList.php index 51b0abcee..347120732 100644 --- a/workflow/engine/methods/processes/processesList.php +++ b/workflow/engine/methods/processes/processesList.php @@ -33,8 +33,6 @@ $oProcess = new Process(); $oProcess->dir = $dir; $oProcess->sort = $sort; -//$memcache = & PMmemcached::getSingleton( config("system.workspace") ); - $memkey = 'no memcache'; $memcacheUsed = 'not used'; $totalCount = 0; From 99700467b8500861e68a2e02deb3ebfc92fb4745 Mon Sep 17 00:00:00 2001 From: Marco Antonio Nina Mena Date: Tue, 10 Oct 2017 16:18:22 -0400 Subject: [PATCH 34/85] HOR-3858 Unauthenticated download of any file from server with "processes/processes_GetFile" page + Path Traversal - Add validation path only PATH_DATA_MAILTEMPLATES or PATH_DATA_PUBLIC - exists process uid --- gulliver/system/class.rbac.php | 6 +++- .../methods/processes/processes_GetFile.php | 35 +++++++++++++++---- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/gulliver/system/class.rbac.php b/gulliver/system/class.rbac.php index e6ccf3752..e23d924e0 100644 --- a/gulliver/system/class.rbac.php +++ b/gulliver/system/class.rbac.php @@ -178,7 +178,11 @@ class RBAC 'DEL' => array('PM_SETUP'), 'LST' => array('PM_SETUP'), 'TEST' => array('PM_SETUP') - ) + ), + 'processes_GetFile.php' => [ + 'mailTemplates' => ['PM_FACTORY'], + 'public' => ['PM_FACTORY'] + ] ); } diff --git a/workflow/engine/methods/processes/processes_GetFile.php b/workflow/engine/methods/processes/processes_GetFile.php index 477f2d6d9..0c8d798c9 100644 --- a/workflow/engine/methods/processes/processes_GetFile.php +++ b/workflow/engine/methods/processes/processes_GetFile.php @@ -1,18 +1,39 @@ allows(basename(__FILE__), $_GET['MAIN_DIRECTORY']); + +$mainDirectory = !empty($_GET['MAIN_DIRECTORY']) ? $_GET['MAIN_DIRECTORY'] : ''; +$proUid = !empty($_GET['PRO_UID']) ? $_GET['PRO_UID'] : ''; +$currentDirectory = !empty($_GET['CURRENT_DIRECTORY']) ? $_GET['CURRENT_DIRECTORY'] . PATH_SEP : ''; +$file = !empty($_GET['FILE']) ? $_GET['FILE'] : ''; +$extension = (!empty($_GET['sFilextension']) && $_GET['sFilextension'] === 'javascript') ? '.js' : ''; + +//validated process exists, return throw if not exists. +$process = new Process(); +$process->load($proUid); + +switch ($mainDirectory) { case 'mailTemplates': - $sDirectory = PATH_DATA_MAILTEMPLATES . $_GET['PRO_UID'] . PATH_SEP . ($_GET['CURRENT_DIRECTORY'] != '' ? $_GET['CURRENT_DIRECTORY'] . PATH_SEP : ''); + $directory = PATH_DATA_MAILTEMPLATES; break; case 'public': - $sDirectory = PATH_DATA_PUBLIC . $_GET['PRO_UID'] . PATH_SEP . ($_GET['CURRENT_DIRECTORY'] != '' ? $_GET['CURRENT_DIRECTORY'] . PATH_SEP : ''); + $directory = PATH_DATA_PUBLIC; break; default: die(); break; } -//fixed: added a file extension when is a javascript file by krlos -$_GET['FILE'] .= ($_GET['sFilextension'] != '' && $_GET['sFilextension'] == 'javascript') ? '.js' : ''; -if (file_exists( $sDirectory . $_GET['FILE'] )) { - G::streamFile( $sDirectory . $_GET['FILE'], true ); +$directory .= $proUid; + +//Delete return directory because path exists in PATH_DATA_MAILTEMPLATES or PATH_DATA_PUBLIC +foreach (pathinfo($currentDirectory) as $value) { + if ($value !== '..') { + $directory .= PATH_SEP . $value; + } +} +$file .= $extension; + +if (file_exists($directory . $file)) { + G::streamFile($directory . $file, true); } From 45c6b0df571a65002583cf721316808170ba2e6c Mon Sep 17 00:00:00 2001 From: Marco Antonio Nina Mena Date: Tue, 10 Oct 2017 16:22:07 -0400 Subject: [PATCH 35/85] - Fix path --- workflow/engine/methods/processes/processes_GetFile.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/workflow/engine/methods/processes/processes_GetFile.php b/workflow/engine/methods/processes/processes_GetFile.php index 0c8d798c9..b8204d97a 100644 --- a/workflow/engine/methods/processes/processes_GetFile.php +++ b/workflow/engine/methods/processes/processes_GetFile.php @@ -24,12 +24,12 @@ switch ($mainDirectory) { break; } -$directory .= $proUid; +$directory .= $proUid . PATH_SEP; //Delete return directory because path exists in PATH_DATA_MAILTEMPLATES or PATH_DATA_PUBLIC foreach (pathinfo($currentDirectory) as $value) { if ($value !== '..') { - $directory .= PATH_SEP . $value; + $directory .= $value . PATH_SEP; } } $file .= $extension; From c7e8614ada79cf86b369a96032586c9ca895feac Mon Sep 17 00:00:00 2001 From: Marco Antonio Nina Mena Date: Wed, 11 Oct 2017 13:26:34 -0400 Subject: [PATCH 36/85] - sanitize field current_directory --- .../engine/methods/processes/processes_GetFile.php | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/workflow/engine/methods/processes/processes_GetFile.php b/workflow/engine/methods/processes/processes_GetFile.php index b8204d97a..02f1ac2dd 100644 --- a/workflow/engine/methods/processes/processes_GetFile.php +++ b/workflow/engine/methods/processes/processes_GetFile.php @@ -4,7 +4,7 @@ $RBAC->allows(basename(__FILE__), $_GET['MAIN_DIRECTORY']); $mainDirectory = !empty($_GET['MAIN_DIRECTORY']) ? $_GET['MAIN_DIRECTORY'] : ''; $proUid = !empty($_GET['PRO_UID']) ? $_GET['PRO_UID'] : ''; -$currentDirectory = !empty($_GET['CURRENT_DIRECTORY']) ? $_GET['CURRENT_DIRECTORY'] . PATH_SEP : ''; +$currentDirectory = !empty($_GET['CURRENT_DIRECTORY']) ? realpath($_GET['CURRENT_DIRECTORY']) . PATH_SEP : ''; $file = !empty($_GET['FILE']) ? $_GET['FILE'] : ''; $extension = (!empty($_GET['sFilextension']) && $_GET['sFilextension'] === 'javascript') ? '.js' : ''; @@ -24,14 +24,7 @@ switch ($mainDirectory) { break; } -$directory .= $proUid . PATH_SEP; - -//Delete return directory because path exists in PATH_DATA_MAILTEMPLATES or PATH_DATA_PUBLIC -foreach (pathinfo($currentDirectory) as $value) { - if ($value !== '..') { - $directory .= $value . PATH_SEP; - } -} +$directory .= $proUid . PATH_SEP . $currentDirectory; $file .= $extension; if (file_exists($directory . $file)) { From 6c96225ce24c8e33660a91f35b194e0675a9a388 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Fri, 13 Oct 2017 11:05:39 -0400 Subject: [PATCH 37/85] HOR-3851 --- workflow/engine/classes/model/UsersProperties.php | 1 - workflow/engine/methods/enterprise/enterprise.php | 2 -- workflow/engine/methods/setup/webServicesAjax.php | 1 - workflow/engine/templates/setup/webServicesTree.php | 1 - 4 files changed, 5 deletions(-) diff --git a/workflow/engine/classes/model/UsersProperties.php b/workflow/engine/classes/model/UsersProperties.php index 7b378188f..784bb0d1e 100644 --- a/workflow/engine/classes/model/UsersProperties.php +++ b/workflow/engine/classes/model/UsersProperties.php @@ -393,7 +393,6 @@ class UsersProperties extends BaseUsersProperties $oConf = new Configurations(); $oConf->loadConfig( $x, 'USER_PREFERENCES', '', '', $_SESSION['USER_LOGGED'], '' ); - //$baseUrl = '/sys' . config("system.workspace") . '/' . $this->lang . '/' . SYS_SKIN . '/'; if (isset($_COOKIE['workspaceSkin'])) { $baseUrl = '/sys' . config("system.workspace") . '/' . $this->lang . '/' . $_COOKIE['workspaceSkin'] . '/'; } else { diff --git a/workflow/engine/methods/enterprise/enterprise.php b/workflow/engine/methods/enterprise/enterprise.php index 2501d8f78..7487de8d4 100644 --- a/workflow/engine/methods/enterprise/enterprise.php +++ b/workflow/engine/methods/enterprise/enterprise.php @@ -81,8 +81,6 @@ class enterprisePlugin extends PMPlugin $js = "window.open(\"/sys" . config("system.workspace") . "/" . SYS_LANG . "/" . SYS_SKIN . "/setup/main?s=PLUGINS\", \"_top\", \"\");"; if (substr(SYS_SKIN, 0, 2) == "ux" && SYS_SKIN != "uxs") { - //$js = "parent.window.location.href = \"/sys" . config("system.workspace") . "/" . SYS_LANG . "/" . SYS_SKIN . "/setup/main_init?s=PLUGINS\";"; - //$js = "window.location.href = \"/sys" . config("system.workspace") . "/" . SYS_LANG . "/" . SYS_SKIN . "/setup/pluginsImport\";"; $js = "window.open(\"/sys" . config("system.workspace") . "/" . SYS_LANG . "/" . SYS_SKIN . "/main\", \"_top\", \"\");"; } diff --git a/workflow/engine/methods/setup/webServicesAjax.php b/workflow/engine/methods/setup/webServicesAjax.php index f99110713..a4d0f2802 100644 --- a/workflow/engine/methods/setup/webServicesAjax.php +++ b/workflow/engine/methods/setup/webServicesAjax.php @@ -94,7 +94,6 @@ switch ($_POST['action']) { $_SESSION['_DBArray'] = $_DBArray; if (! isset( $_SESSION['END_POINT'] )) { - //$wsdl = 'http://'.$_SERVER['HTTP_HOST'].'/sys'.config("system.workspace"). '/'. SYS_LANG .'/classic/services/wsdl'; $wsdl = 'http://' . $_SERVER['HTTP_HOST']; $workspace = config("system.workspace"); } else { diff --git a/workflow/engine/templates/setup/webServicesTree.php b/workflow/engine/templates/setup/webServicesTree.php index b853d4991..6f2c78d69 100644 --- a/workflow/engine/templates/setup/webServicesTree.php +++ b/workflow/engine/templates/setup/webServicesTree.php @@ -38,7 +38,6 @@ if (isset ( $_GET ['x'] )) { } } else { if (! isset ( $_SESSION ['END_POINT'] )) { - //$wsdl = 'http://'.$_SERVER['HTTP_HOST'].'/sys'.config("system.workspace").'/en/classic/services/wsdl'; $wsdl = 'http://' . $_SERVER ['HTTP_HOST']; $workspace = config("system.workspace"); } else { From 313103f591a2343de725294a2c9474a668163a9b Mon Sep 17 00:00:00 2001 From: Marco Antonio Nina Mena Date: Mon, 16 Oct 2017 15:47:36 -0400 Subject: [PATCH 38/85] Add realpath to variable File --- workflow/engine/methods/processes/processes_GetFile.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow/engine/methods/processes/processes_GetFile.php b/workflow/engine/methods/processes/processes_GetFile.php index 02f1ac2dd..685519820 100644 --- a/workflow/engine/methods/processes/processes_GetFile.php +++ b/workflow/engine/methods/processes/processes_GetFile.php @@ -5,7 +5,7 @@ $RBAC->allows(basename(__FILE__), $_GET['MAIN_DIRECTORY']); $mainDirectory = !empty($_GET['MAIN_DIRECTORY']) ? $_GET['MAIN_DIRECTORY'] : ''; $proUid = !empty($_GET['PRO_UID']) ? $_GET['PRO_UID'] : ''; $currentDirectory = !empty($_GET['CURRENT_DIRECTORY']) ? realpath($_GET['CURRENT_DIRECTORY']) . PATH_SEP : ''; -$file = !empty($_GET['FILE']) ? $_GET['FILE'] : ''; +$file = !empty($_GET['FILE']) ? realpath($_GET['FILE']) : ''; $extension = (!empty($_GET['sFilextension']) && $_GET['sFilextension'] === 'javascript') ? '.js' : ''; //validated process exists, return throw if not exists. From b26beb72c45d24f90ebafef95410110a8ff3db36 Mon Sep 17 00:00:00 2001 From: Paula Quispe Date: Fri, 13 Oct 2017 15:02:14 -0400 Subject: [PATCH 39/85] HOR-3521 --- workflow/engine/classes/model/ListInbox.php | 76 +++++++++++++++--- .../classes/model/ListParticipatedLast.php | 80 ++++++++++++++++--- workflow/engine/classes/model/ListPaused.php | 79 +++++++++++++++--- .../methods/cases/proxyNewCasesList.php | 13 ++- .../src/ProcessMaker/BusinessModel/Cases.php | 59 +++++++++++++- 5 files changed, 263 insertions(+), 44 deletions(-) diff --git a/workflow/engine/classes/model/ListInbox.php b/workflow/engine/classes/model/ListInbox.php index c97fa5fc6..b831c6973 100644 --- a/workflow/engine/classes/model/ListInbox.php +++ b/workflow/engine/classes/model/ListInbox.php @@ -1,6 +1,7 @@ additionalClassName; + } + + /** + * Set the value of $additionalClassName. + * + * @param string $v new value + * @return void + */ + public function setAdditionalClassName($v) + { + $this->additionalClassName = $v; + } + + /** + * Get the $userDisplayFormat value. + * + * @return string + */ + public function getUserDisplayFormat() + { + return $this->userDisplayFormat; + } + + /** + * Set the value of $userDisplayFormat. + * + * @param string $v new value + * @return void + */ + public function setUserDisplayFormat($v) + { + $this->userDisplayFormat = $v; + } /** * Create List Inbox Table * * @param type $data * @return type - * + * @throws Exception */ public function create($data, $isSelfService = false) { @@ -115,7 +159,7 @@ class ListInbox extends BaseListInbox * * @param type $data * @return type - * @throws type + * @throws Exception */ public function update($data, $isSelfService = false) { @@ -209,7 +253,7 @@ class ListInbox extends BaseListInbox * * @param type $seqName * @return type - * @throws type + * @throws Exception * */ public function remove($app_uid, $del_index) @@ -233,7 +277,7 @@ class ListInbox extends BaseListInbox * * @param type $seqName * @return type - * @throws type + * @throws Exception * */ public function removeAll($app_uid) @@ -478,8 +522,14 @@ class ListInbox extends BaseListInbox $criteria->add(ListInboxPeer::APP_UID, $search, Criteria::EQUAL); } else { //If we have additional tables configured in the custom cases list, prepare the variables for search - $casesList = new \ProcessMaker\BusinessModel\Cases(); - $casesList->getSearchCriteriaListCases($criteria, __CLASS__ . 'Peer', $search, $this->additionalClassName, $additionalColumns); + $casesList = new BmCases(); + $casesList->getSearchCriteriaListCases( + $criteria, + __CLASS__ . 'Peer', + $search, + $this->getAdditionalClassName(), + $additionalColumns + ); } } @@ -515,7 +565,7 @@ class ListInbox extends BaseListInbox * This function get the information in the corresponding cases list * @param string $usr_uid, must be show cases related to this user * @param array $filters for apply in the result - * @param null $callbackRecord + * @param callable $callbackRecord * @return array $data * @throws PropelException */ @@ -524,7 +574,7 @@ class ListInbox extends BaseListInbox $pmTable = new PmTable(); $list = isset($filters['action']) ? $filters['action'] : ""; $criteria = $pmTable->addPMFieldsToList($list); - $this->additionalClassName = $pmTable->tableClassName; + $this->setAdditionalClassName($pmTable->tableClassName); $additionalColumns = $criteria->getSelectColumns(); $filters['usr_uid'] = $usr_uid; @@ -556,14 +606,16 @@ class ListInbox extends BaseListInbox self::loadFilters($criteria, $filters, $additionalColumns); //We will be defined the sort - $casesList = new \ProcessMaker\BusinessModel\Cases(); + $casesList = new BmCases(); + $sort = $casesList->getSortColumn( __CLASS__ . 'Peer', BasePeer::TYPE_FIELDNAME, empty($filters['sort']) ? "APP_UPDATE_DATE" : $filters['sort'], "APP_UPDATE_DATE", - $this->additionalClassName, - $additionalColumns + $this->getAdditionalClassName(), + $additionalColumns, + $this->getUserDisplayFormat() ); $dir = isset($filters['dir']) ? $filters['dir'] : "ASC"; diff --git a/workflow/engine/classes/model/ListParticipatedLast.php b/workflow/engine/classes/model/ListParticipatedLast.php index 56962c98e..230c48f3d 100644 --- a/workflow/engine/classes/model/ListParticipatedLast.php +++ b/workflow/engine/classes/model/ListParticipatedLast.php @@ -1,7 +1,7 @@ additionalClassName; + } + + /** + * Set the value of $additionalClassName. + * + * @param string $v new value + * @return void + */ + public function setAdditionalClassName($v) + { + $this->additionalClassName = $v; + } + + /** + * Get the $userDisplayFormat value. + * + * @return string + */ + public function getUserDisplayFormat() + { + return $this->userDisplayFormat; + } + + /** + * Set the value of $userDisplayFormat. + * + * @param string $v new value + * @return void + */ + public function setUserDisplayFormat($v) + { + $this->userDisplayFormat = $v; + } /** * Create List Participated History Table. @@ -22,6 +65,7 @@ class ListParticipatedLast extends BaseListParticipatedLast * @param type $data * * @return type + * @throws Exception */ public function create($data) { @@ -142,7 +186,7 @@ class ListParticipatedLast extends BaseListParticipatedLast * * @return type * - * @throws type + * @throws Exception */ public function update($data) { @@ -180,11 +224,12 @@ class ListParticipatedLast extends BaseListParticipatedLast /** * Refresh List Participated Last. * - * @param type $seqName + * @param array $data + * @param boolean $isSelfService * * @return type * - * @throws type + * @throws Exception */ public function refresh($data, $isSelfService = false) { @@ -235,11 +280,13 @@ class ListParticipatedLast extends BaseListParticipatedLast /** * Remove List Participated History. * - * @param type $seqName + * @param string $app_uid + * @param string $usr_uid + * @param integer $del_index * * @return type * - * @throws type + * @throws Exception */ public function remove($app_uid, $usr_uid, $del_index) { @@ -319,8 +366,14 @@ class ListParticipatedLast extends BaseListParticipatedLast $criteria->add(ListParticipatedLastPeer::APP_UID, $search, Criteria::EQUAL); } else { //If we have additional tables configured in the custom cases list, prepare the variables for search - $casesList = new \ProcessMaker\BusinessModel\Cases(); - $casesList->getSearchCriteriaListCases($criteria, __CLASS__ . 'Peer', $search, $this->additionalClassName, $additionalColumns); + $casesList = new BmCases(); + $casesList->getSearchCriteriaListCases( + $criteria, + __CLASS__ . 'Peer', + $search, + $this->getAdditionalClassName(), + $additionalColumns + ); } } @@ -352,7 +405,7 @@ class ListParticipatedLast extends BaseListParticipatedLast * This function get the information in the corresponding cases list * @param string $usr_uid, must be show cases related to this user * @param array $filters for apply in the result - * @param null $callbackRecord + * @param callable $callbackRecord * @param string $appUid related to the specific case * @return array $data * @throws PropelException @@ -361,7 +414,7 @@ class ListParticipatedLast extends BaseListParticipatedLast { $pmTable = new PmTable(); $criteria = $pmTable->addPMFieldsToList('sent'); - $this->additionalClassName = $pmTable->tableClassName; + $this->setAdditionalClassName($pmTable->tableClassName); $additionalColumns = $criteria->getSelectColumns(); $criteria->addSelectColumn(ListParticipatedLastPeer::APP_UID); @@ -397,14 +450,15 @@ class ListParticipatedLast extends BaseListParticipatedLast self::loadFilters($criteria, $filters, $additionalColumns); //We will be defined the sort - $casesList = new \ProcessMaker\BusinessModel\Cases(); + $casesList = new BmCases(); $sort = $casesList->getSortColumn( __CLASS__ . 'Peer', BasePeer::TYPE_FIELDNAME, empty($filters['sort']) ? "DEL_DELEGATE_DATE" : $filters['sort'], "DEL_DELEGATE_DATE", - $this->additionalClassName, - $additionalColumns + $this->getAdditionalClassName(), + $additionalColumns, + $this->getUserDisplayFormat() ); $dir = isset($filters['dir']) ? $filters['dir'] : 'ASC'; diff --git a/workflow/engine/classes/model/ListPaused.php b/workflow/engine/classes/model/ListPaused.php index 1b885020d..804bde419 100644 --- a/workflow/engine/classes/model/ListPaused.php +++ b/workflow/engine/classes/model/ListPaused.php @@ -1,7 +1,7 @@ additionalClassName; + } + + /** + * Set the value of $additionalClassName. + * + * @param string $v new value + * @return void + */ + public function setAdditionalClassName($v) + { + $this->additionalClassName = $v; + } + + /** + * Get the $userDisplayFormat value. + * + * @return string + */ + public function getUserDisplayFormat() + { + return $this->userDisplayFormat; + } + + /** + * Set the value of $userDisplayFormat. + * + * @param string $v new value + * @return void + */ + public function setUserDisplayFormat($v) + { + $this->userDisplayFormat = $v; + } /** * Create List Paused Table * * @param type $data * @return type - * + * @throws Exception */ public function create($data) { @@ -153,7 +196,7 @@ class ListPaused extends BaseListPaused * * @param type $data * @return type - * @throws type + * @throws Exception */ public function update($data) { @@ -187,9 +230,12 @@ class ListPaused extends BaseListPaused /** * Remove List Paused * - * @param type $seqName + * @param string $app_uid + * @param integer $del_index + * @param array $data_inbox + * * @return type - * @throws type + * @throws Exception * */ public function remove($app_uid, $del_index, $data_inbox) @@ -246,8 +292,14 @@ class ListPaused extends BaseListPaused $criteria->add(ListPausedPeer::APP_UID, $search, Criteria::EQUAL); } else { //If we have additional tables configured in the custom cases list, prepare the variables for search - $casesList = new \ProcessMaker\BusinessModel\Cases(); - $casesList->getSearchCriteriaListCases($criteria, __CLASS__ . 'Peer', $search, $this->additionalClassName, $additionalColumns); + $casesList = new BmCases(); + $casesList->getSearchCriteriaListCases( + $criteria, + __CLASS__ . 'Peer', + $search, + $this->getAdditionalClassName(), + $additionalColumns + ); } } @@ -270,7 +322,7 @@ class ListPaused extends BaseListPaused * This function get the information in the corresponding cases list * @param string $usr_uid, must be show cases related to this user * @param array $filters for apply in the result - * @param null $callbackRecord + * @param callable $callbackRecord * @return array $data * @throws PropelException */ @@ -279,7 +331,7 @@ class ListPaused extends BaseListPaused $resp = array(); $pmTable = new PmTable(); $criteria = $pmTable->addPMFieldsToList('paused'); - $this->additionalClassName = $pmTable->tableClassName; + $this->setAdditionalClassName($pmTable->tableClassName); $additionalColumns = $criteria->getSelectColumns(); $criteria->addSelectColumn(ListPausedPeer::APP_UID); @@ -308,14 +360,15 @@ class ListPaused extends BaseListPaused self::loadFilters($criteria, $filters, $additionalColumns); //We will be defined the sort - $casesList = new \ProcessMaker\BusinessModel\Cases(); + $casesList = new BmCases(); $sort = $casesList->getSortColumn( __CLASS__ . 'Peer', BasePeer::TYPE_FIELDNAME, empty($filters['sort']) ? "APP_PAUSED_DATE" : $filters['sort'], "APP_PAUSED_DATE", - $this->additionalClassName, - $additionalColumns + $this->getAdditionalClassName(), + $additionalColumns, + $this->getUserDisplayFormat() ); $dir = isset($filters['dir']) ? $filters['dir'] : "ASC"; diff --git a/workflow/engine/methods/cases/proxyNewCasesList.php b/workflow/engine/methods/cases/proxyNewCasesList.php index ae559eceb..113c95d73 100644 --- a/workflow/engine/methods/cases/proxyNewCasesList.php +++ b/workflow/engine/methods/cases/proxyNewCasesList.php @@ -90,8 +90,11 @@ try { $filters['limit'] = (int)$filters['limit']; $filters['limit'] = abs($filters['limit']); + $conf = new Configurations(); + $formats = $conf->getFormats(); + $list->setUserDisplayFormat($formats['format']); + if ($filters['limit'] == 0) { - $conf = new Configurations(); $generalConfCasesList = $conf->getConfiguration('ENVIRONMENT_SETTINGS', ''); if (isset($generalConfCasesList['casesListRowNumber'])) { $filters['limit'] = (int)$generalConfCasesList['casesListRowNumber']; @@ -101,10 +104,11 @@ try { } else { $filters['limit'] = (int)$filters['limit']; } - + switch ($filters['sort']) { case 'APP_CURRENT_USER': - $filters['sort'] = 'DEL_CURRENT_USR_LASTNAME'; + //This value is format according to the userDisplayFormat, for this reason we will sent the UID + $filters['sort'] = 'USR_UID'; break; case 'DEL_TASK_DUE_DATE': $filters['sort'] = 'DEL_DUE_DATE'; @@ -113,7 +117,8 @@ try { $filters['sort'] = 'DEL_DELEGATE_DATE'; break; case 'APP_DEL_PREVIOUS_USER': - $filters['sort'] = 'DEL_DUE_DATE'; + //This value is format according to the userDisplayFormat, for this reason we will sent the UID + $filters['sort'] = 'DEL_PREVIOUS_USR_UID'; break; case 'DEL_CURRENT_TAS_TITLE': $filters['sort'] = 'APP_TAS_TITLE'; diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php b/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php index 938a61b01..6b46c8e7d 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php @@ -3408,9 +3408,11 @@ class Cases * @param string $defaultSort, name of column by sort default * @param string $additionalClassName, name of the className of pmTable * @param array $additionalColumns, columns related to the custom cases list with the format TABLE_NAME.COLUMN_NAME + * @param string $userDisplayFormat, user information display format + * * @return string $tableName */ - public function getSortColumn($listPeer, $field, $sort, $defaultSort, $additionalClassName = '', $additionalColumns = array()) + public function getSortColumn($listPeer, $field, $sort, $defaultSort, $additionalClassName = '', $additionalColumns = array(), $userDisplayFormat = '') { $columnSort = $defaultSort; $tableName = ''; @@ -3418,7 +3420,17 @@ class Cases //We will check if the column by sort is a LIST table $columnsList = $listPeer::getFieldNames($field); if (in_array($sort, $columnsList)) { - $columnSort = $listPeer::TABLE_NAME . '.' . $sort; + switch ($sort) { + case 'DEL_PREVIOUS_USR_UID': + $columnSort = $this->buildOrderFieldFormatted($columnsList, $userDisplayFormat, 'DEL_PREVIOUS_'); + break; + case 'USR_UID': + $columnSort = $this->buildOrderFieldFormatted($columnsList, $userDisplayFormat, 'DEL_CURRENT_'); + break; + default: + $columnSort = $listPeer::TABLE_NAME . '.' . $sort; + } + } else { //We will sort by CUSTOM CASE LIST table if (count($additionalColumns) > 0) { @@ -3435,4 +3447,47 @@ class Cases return $columnSort; } + + /** + * When we order columns related to the user information we need to use the userDisplayFormat + * + * @param array $columnsList, the list of columns in the table + * @param string $format, the user display format + * @param string $prefix, the initial name of the columns related to the USR_FIRSTNAME USR_LASTNAME USR_USERNAME + * @return string $columnSort, columns by apply the sql command ORDER BY + */ + public function buildOrderFieldFormatted($columnsList, $format, $prefix = 'DEL_PREVIOUS_') + { + $columnSort = ''; + + if (in_array($prefix . 'USR_FIRSTNAME', $columnsList) && + in_array($prefix . 'USR_LASTNAME', $columnsList) && + in_array($prefix . 'USR_USERNAME', $columnsList) + ) { + switch ($format) { + case '@firstName @lastName': + $columnSort = $prefix . 'USR_FIRSTNAME' . ',' . $prefix . 'USR_LASTNAME'; + break; + case '@firstName @lastName (@userName)': + $columnSort = $prefix . 'USR_FIRSTNAME' . ',' . $prefix . 'USR_LASTNAME' . ',' . $prefix . 'USR_USERNAME'; + break; + case '@userName': + $columnSort = $prefix . 'USR_USERNAME'; + break; + case '@userName (@firstName @lastName)': + $columnSort = $prefix . 'USR_USERNAME' . ',' . $prefix . 'USR_FIRSTNAME' . ',' . $prefix . 'USR_LASTNAME'; + break; + case '@lastName, @firstName': + $columnSort = $prefix . 'USR_LASTNAME' . ',' . $prefix . 'USR_FIRSTNAME'; + break; + case '@lastName, @firstName (@userName)': + $columnSort = $prefix . 'USR_LASTNAME' . ',' . $prefix . 'USR_FIRSTNAME' . ',' . $prefix . 'USR_USERNAME'; + break; + default: + $columnSort = $prefix . 'USR_USERNAME'; + break; + } + } + return $columnSort; + } } From adc0c23acf924e7f9cf056d16e49d97623ce302d Mon Sep 17 00:00:00 2001 From: Paula Quispe Date: Fri, 13 Oct 2017 17:48:08 -0400 Subject: [PATCH 40/85] HOR-3980 --- gulliver/system/class.rbac.php | 2 +- workflow/engine/bin/cron_single.php | 2 +- workflow/engine/classes/class.pmFunctions.php | 2 +- .../triggers/class.pmAlfrescoFunctions.php | 4 +- .../translations/english/processmaker.en.po | 94 +++++++++++-------- workflow/engine/data/mysql/insert.sql | 18 ++-- workflow/engine/menus/setup.php | 4 +- 7 files changed, 74 insertions(+), 52 deletions(-) diff --git a/gulliver/system/class.rbac.php b/gulliver/system/class.rbac.php index e6ccf3752..97151b2ec 100644 --- a/gulliver/system/class.rbac.php +++ b/gulliver/system/class.rbac.php @@ -338,7 +338,7 @@ class RBAC ), array("PER_UID" => "00000000000000000000000000000038", "PER_CODE" => "PM_UNCANCELCASE", "PER_NAME" => "Undo cancel case" ), array("PER_UID" => "00000000000000000000000000000039", "PER_CODE" => "PM_REST_API_APPLICATIONS", - "PER_NAME" => "Create rest API Aplications" + "PER_NAME" => "Register External Applications" ), array("PER_UID" => "00000000000000000000000000000040", "PER_CODE" => "PM_EDIT_USER_PROFILE_FIRST_NAME", "PER_NAME" => "Edit User profile First Name" ), array("PER_UID" => "00000000000000000000000000000041", "PER_CODE" => "PM_EDIT_USER_PROFILE_LAST_NAME", diff --git a/workflow/engine/bin/cron_single.php b/workflow/engine/bin/cron_single.php index ae686b118..e3571a3c7 100644 --- a/workflow/engine/bin/cron_single.php +++ b/workflow/engine/bin/cron_single.php @@ -819,7 +819,7 @@ function executeCaseSelfService() unset($appFields['APP_PIN']); $case->updateCase($appFields["APP_UID"], $appFields); - saveLog("unassignedCase", "action", "OK Executed tigger to the case $appcacheAppNumber"); + saveLog("unassignedCase", "action", "OK Executed trigger to the case $appcacheAppNumber"); } } diff --git a/workflow/engine/classes/class.pmFunctions.php b/workflow/engine/classes/class.pmFunctions.php index 14f5896b9..6f751d1bc 100644 --- a/workflow/engine/classes/class.pmFunctions.php +++ b/workflow/engine/classes/class.pmFunctions.php @@ -2098,7 +2098,7 @@ function PMFDerivateCase ($caseId, $delIndex, $bExecuteTriggersBeforeAssignment * @param string(32) | $processId | Process ID | The unique ID of the process. * @param string(32) | $userId | User ID | The unique ID of the user. * @param array | $variables | Array of variables | An associative array of the variables which will be sent to the case. - * @param string(32) | $taskId | The unique ID of the task taha is in the starting group. + * @param string(32) | $taskId | The unique ID of the task that is in the starting group. * @return int | $result | Result | Returns 1 if new case was created successfully; otherwise, returns 0 if an error occurred. * */ diff --git a/workflow/engine/classes/triggers/class.pmAlfrescoFunctions.php b/workflow/engine/classes/triggers/class.pmAlfrescoFunctions.php index bff416aeb..209f617c7 100644 --- a/workflow/engine/classes/triggers/class.pmAlfrescoFunctions.php +++ b/workflow/engine/classes/triggers/class.pmAlfrescoFunctions.php @@ -305,10 +305,10 @@ function getFolderChildren($alfrescoServerUrl, $folderId, $user, $pwd) /** * @method * - * Uplaod file/document in Alfresco Repository + * Upload file/document in Alfresco Repository * * @name uploadDoc - * @label Uplaod file/document in Alfresco Repository + * @label Upload file/document in Alfresco Repository * * @param string | $alfrescoServerUrl | Server name and port where Alfresco exists | http://localhost:8080/alfresco * @param string | $fileSource | File Source diff --git a/workflow/engine/content/translations/english/processmaker.en.po b/workflow/engine/content/translations/english/processmaker.en.po index bf7890e93..c4a5e3303 100644 --- a/workflow/engine/content/translations/english/processmaker.en.po +++ b/workflow/engine/content/translations/english/processmaker.en.po @@ -1750,8 +1750,62 @@ msgstr "Changes saved" # TRANSLATION # LABEL/ID_EMAILS #: LABEL/ID_EMAILS -msgid "EMAILS" -msgstr "EMAILS" +msgid "Emails" +msgstr "Emails" + +# TRANSLATION +# LABEL/ID_NO_PREVIOUS_USR_UID +#: LABEL/ID_NO_PREVIOUS_USR_UID +msgid "The previous task doesn't have any users." +msgstr "The previous task doesn't have any users." + +# TRANSLATION +# LABEL/ID_SET_NO_MANAGER +#: LABEL/ID_SET_NO_MANAGER +msgid "Unassign Manager" +msgstr "Unassign Manager" + +# TRANSLATION +# LABEL/ID_ERROR_EMAIL +#: LABEL/ID_ERROR_EMAIL +msgid "Error" +msgstr "Error" + +# TRANSLATION +# LABEL/ID_CASE_SCHEDULER_CLASSIC +#: LABEL/ID_CASE_SCHEDULER_CLASSIC +msgid "Case Scheduler (classic processes)" +msgstr "Case Scheduler (classic processes)" + +# TRANSLATION +# LABEL/ID_PROCESS_IS_REQUIRED +#: LABEL/ID_PROCESS_IS_REQUIRED +msgid "Process field is required" +msgstr "Process field is required" + +# TRANSLATION +# LABEL/ID_DELEGATE_DATE_FROM +#: LABEL/ID_DELEGATE_DATE_FROM +msgid "Date from" +msgstr "Date from" + +# TRANSLATION +# LABEL/ID_REASSIGN_CONFIRM +#: LABEL/ID_REASSIGN_CONFIRM +msgid "Do you want to reassign the case?" +msgstr "Do you want to reassign the case?" + +# TRANSLATION +# LABEL/ID_MESSAGE_SUBJECT_NOTE_NOTIFICATION +#: LABEL/ID_MESSAGE_SUBJECT_NOTE_NOTIFICATION +msgid "A note has been added to the case" +msgstr "A note has been added to the case" + +# TRANSLATION +# LABEL/ID_EVENTS_CLASSIC +#: LABEL/ID_EVENTS_CLASSIC +msgid "Events (classic processes)" +msgstr "Events (classic processes)" # TRANSLATION # LABEL/ID_REPORT2 @@ -5360,12 +5414,6 @@ msgstr "Can not save, because, there is an Output Document with the same name in msgid "User or password is empty." msgstr "User or password is empty." -# TRANSLATION -# LABEL/ID_DELEGATE_DATE_FROM -#: LABEL/ID_DELEGATE_DATE_FROM -msgid "Delegated date from" -msgstr "Delegated date from" - # TRANSLATION # JAVASCRIPT/ID_DUPLICATE_CATEGORY_NAME #: JAVASCRIPT/ID_DUPLICATE_CATEGORY_NAME @@ -6872,12 +6920,6 @@ msgstr "Last Name" msgid "Case #{APP_NUMBER} was reassigned to user {USER}." msgstr "Case #{APP_NUMBER} was reassigned to user {USER}." -# TRANSLATION -# LABEL/ID_REASSIGN_CONFIRM -#: LABEL/ID_REASSIGN_CONFIRM -msgid "Are you sure to reassign the current case?" -msgstr "Are you sure to reassign the current case?" - # TRANSLATION # LABEL/ID_CASE_PAUSED_SUCCESSFULLY #: LABEL/ID_CASE_PAUSED_SUCCESSFULLY @@ -10508,12 +10550,6 @@ msgstr "From each table select at least one Schema/Data to export." msgid "Do you want to delete the selected skin?" msgstr "Do you want to delete the selected skin?" -# TRANSLATION -# LABEL/ID_MESSAGE_SUBJECT_NOTE_NOTIFICATION -#: LABEL/ID_MESSAGE_SUBJECT_NOTE_NOTIFICATION -msgid "A note has been added to the case." -msgstr "A note has been added to the case." - # TRANSLATION # LABEL/ID_MSG_CANNOT_EXPORT_DEFAULT_SKIN #: LABEL/ID_MSG_CANNOT_EXPORT_DEFAULT_SKIN @@ -18685,12 +18721,6 @@ msgstr "Compare" msgid "You can click on one of the dashboards to view the data or click on the favorite icon to make it your main dashboard." msgstr "You can click on one of the dashboards to view the data or click on the favorite icon to make it your main dashboard." -# TRANSLATION -# LABEL/ID_SET_NO_MANAGER -#: LABEL/ID_SET_NO_MANAGER -msgid "No set Manager" -msgstr "No set Manager" - # TRANSLATION # LABEL/ID_NO_SET_MANAGER_SUCCES #: LABEL/ID_NO_SET_MANAGER_SUCCES @@ -18895,12 +18925,6 @@ msgstr "(Goal value)" msgid "Please enter your credentials below" msgstr "Please enter your credentials below" -# TRANSLATION -# LABEL/ID_ERROR_EMAIL -#: LABEL/ID_ERROR_EMAIL -msgid "Error email" -msgstr "Error email" - # TRANSLATION # LABEL/ID_AVAILABLE_DATABASE #: LABEL/ID_AVAILABLE_DATABASE @@ -27473,12 +27497,6 @@ msgstr "Error: The application {0} is not canceled." msgid "Error: Thread status does not exist for the application {0}." msgstr "Error: Thread status does not exist for the application {0}." -# TRANSLATION -# LABEL/ID_NO_PREVIOUS_USR_UID -#: LABEL/ID_NO_PREVIOUS_USR_UID -msgid "The previuos task doesn't have any users." -msgstr "The previuos task doesn't have any users." - # TRANSLATION # LABEL/ID_WARNING_GATEWAY_CONVERGENT_WITH_CONDITION #: LABEL/ID_WARNING_GATEWAY_CONVERGENT_WITH_CONDITION diff --git a/workflow/engine/data/mysql/insert.sql b/workflow/engine/data/mysql/insert.sql index 524d1777b..c36449fee 100644 --- a/workflow/engine/data/mysql/insert.sql +++ b/workflow/engine/data/mysql/insert.sql @@ -44,6 +44,7 @@ INSERT INTO CONTENT (CON_CATEGORY,CON_PARENT,CON_ID,CON_LANG,CON_VALUE) VALUES ('PER_NAME','','00000000000000000000000000000036','en','Delete process cases'), ('PER_NAME','','00000000000000000000000000000037','en','Edit personal info Calendar'), ('PER_NAME','','00000000000000000000000000000038','en','Undo cancel case'), +('PER_NAME','','00000000000000000000000000000039','en','Register External Applications'), ('PER_NAME','','00000000000000000000000000000040','en','Edit User profile First Name'), ('PER_NAME','','00000000000000000000000000000041','en','Edit User profile Last Name'), ('PER_NAME','','00000000000000000000000000000042','en','Edit User profile Username'), @@ -1730,7 +1731,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'JAVASCRIPT','ID_DBS_NEW','en','Add new Database Source','2014-01-15') , ( 'JAVASCRIPT','ID_DBS_LIST','en','Databases Source List','2014-01-15') , ( 'LABEL','ID_CHANGES_SAVED','en','Changes saved','2014-01-15') , -( 'LABEL','ID_EMAILS','en','EMAILS','2014-01-15') , +( 'LABEL','ID_EMAILS','en','Emails','2017-10-18') , ( 'LABEL','ID_REPORT2','en','Number of cases per process','2014-01-15') , ( 'LABEL','ID_REPORT1','en','Case duration by process and task','2014-01-15') , ( 'LABEL','ID_IUD','en','#','2014-01-15') , @@ -2346,7 +2347,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'JAVASCRIPT','ID_EXIST_INPUTDOCUMENT','en','Can not save, because there is an Input Document with the same name in this process.','2014-01-15') , ( 'JAVASCRIPT','ID_EXIST_OUTPUTDOCUMENT','en','Can not save, because, there is an Output Document with the same name in this process.','2014-01-15') , ( 'LABEL','ID_CASE_SCHEDULER_VALIDATE_ALERT','en','User or password is empty.','2014-10-21') , -( 'LABEL','ID_DELEGATE_DATE_FROM','en','Delegated date from','2014-01-15') , +( 'LABEL','ID_DELEGATE_DATE_FROM','en','Date from','2017-10-18') , ( 'JAVASCRIPT','ID_DUPLICATE_CATEGORY_NAME','en','Duplicate category name.','2014-01-15') ; INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ) VALUES @@ -2606,7 +2607,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_FIRSTNAME','en','First Name','2014-01-15') , ( 'LABEL','ID_LASTNAME','en','Last Name','2014-01-15') , ( 'LABEL','ID_REASSIGNMENT_SUCCESS','en','Case #{APP_NUMBER} was reassigned to user {USER}.','2014-01-15') , -( 'LABEL','ID_REASSIGN_CONFIRM','en','Are you sure to reassign the current case?','2014-01-15') , +( 'LABEL','ID_REASSIGN_CONFIRM','en','Do you want to reassign the case?','2017-10-18') , ( 'LABEL','ID_CASE_PAUSED_SUCCESSFULLY','en','The Case {APP_NUMBER} was paused successfully and it will be unpaused on date {UNPAUSE_DATE}','2014-01-15') , ( 'LABEL','ID_VACATION','en','Vacation','2014-01-15') , ( 'JAVASCRIPT','ID_DB_CONNECTION_ASSIGN','en','You cannot delete this database connection. It is assigned to a step.','2014-01-15') , @@ -3226,7 +3227,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_TABLES_TO_EXPORT','en','Tables To Export','2014-01-15') , ( 'LABEL','ID_PMTABLES_NOTICE_EXPORT','en','From each table select at least one Schema/Data to export.','2014-10-21') , ( 'LABEL','ID_CONFIRM_DELETE_SKIN','en','Do you want to delete the selected skin?','2017-04-21') , -( 'LABEL','ID_MESSAGE_SUBJECT_NOTE_NOTIFICATION','en','A note has been added to the case.','2014-10-21') , +( 'LABEL','ID_MESSAGE_SUBJECT_NOTE_NOTIFICATION','en','A note has been added to the case','2017-10-18') , ( 'LABEL','ID_MSG_CANNOT_EXPORT_DEFAULT_SKIN','en','Default skin can''t be exported. Instead create new one based on default','2014-01-15') , ( 'LABEL','ID_MSG_CANNOT_EXPORT_SKIN','en','Can''t export skin. Server Error','2014-01-15') , ( 'LABEL','ID_NEW_SKIN','en','New Skin','2014-01-15') , @@ -3867,6 +3868,9 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_EVENT_DESCRIPTION','en','Event Description','2014-01-15') , ( 'LABEL','ID_EVENT_ACTION','en','Event Type','2014-01-15') , ( 'LABEL','ID_EVENTS','en','Events','2014-01-15') , +( 'LABEL','ID_EVENTS_CLASSIC','en','Events (classic processes)','2017-13-10') , +( 'LABEL','ID_CASE_SCHEDULER_CLASSIC','en','Case Scheduler (classic processes)','2017-13-10') , +( 'LABEL','ID_PROCESS_IS_REQUIRED','en','Process field is required','2017-13-10') , ( 'LABEL','ID_EVENT_LIST','en','Log of events','2014-01-15') , ( 'LABEL','ID_EMPTY_TYPE','en','Select a Type','2014-01-15') , ( 'LABEL','ID_GRID_PAGE_NO_EVENT_MESSAGE','en','No Events to display','2014-01-15') , @@ -4624,7 +4628,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_DASH_COMPARE_MONTH','en','Compare this month with','2015-05-26') , ( 'LABEL','ID_DASH_COMPARE','en','Compare','2015-03-18') , ( 'LABEL','ID_DASH_CLICK_TO_VIEW','en','You can click on one of the dashboards to view the data or click on the favorite icon to make it your main dashboard.','2015-03-18') , -( 'LABEL','ID_SET_NO_MANAGER','en','No set Manager','2015-03-18') , +( 'LABEL','ID_SET_NO_MANAGER','en','Unassign Manager','2017-10-18') , ( 'LABEL','ID_NO_SET_MANAGER_SUCCES','en','Manager unassigned correctly','2015-03-18') , ( 'LABEL','ID_INDICATOR_PROCESS_REQUIRED','en','The field Process of indicator "{0}" is required.','2015-03-18') , ( 'LABEL','ID_INDICATOR_TITLE_REQUIRED','en','The field Title of indicator "{0}" is required.','2015-03-18') , @@ -4661,7 +4665,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_UNTITLED_TASK','en','Untitled task','2015-04-01') , ( 'LABEL','ID_GOAL_HELP','en','(Goal value)','2015-04-06') , ( 'LABEL','ID_PLEASE_ENTER_CREDENTIALS','en','Please enter your credentials below','2015-04-09') , -( 'LABEL','ID_ERROR_EMAIL','en','Error email','2015-04-20') , +( 'LABEL','ID_ERROR_EMAIL','en','Error','2017-10-18') , ( 'LABEL','ID_AVAILABLE_DATABASE','en','Available.','2015-04-21') , ( 'LABEL','ID_NOT_AVAILABLE_DATABASE','en','Not available.','2015-04-21') , ( 'LABEL','ID_WRONG_USER_PASS','en','Wrong username or password.','2015-04-22') , @@ -6124,7 +6128,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_YOU_DO_NOT_HAVE_PERMISSION','en','Error: You do not have permission.','2016-06-15') , ( 'LABEL','ID_THE_APPLICATION_IS_NOT_CANCELED','en','Error: The application {0} is not canceled.','2016-06-15') , ( 'LABEL','ID_THREAD_STATUS_DOES_NOT_EXIST_FOR_THE_APPLICATION','en','Error: Thread status does not exist for the application {0}.','2016-06-15') , -( 'LABEL','ID_NO_PREVIOUS_USR_UID','en','The previuos task doesn''t have any users.','2016-06-17') , +( 'LABEL','ID_NO_PREVIOUS_USR_UID','en','The previous task doesn''t have any users.','2017-10-18') , ( 'LABEL','ID_WARNING_GATEWAY_CONVERGENT_WITH_CONDITION','en','Your Gateway Convergent has a condition, save again your process.','2016-06-23') , ( 'LABEL','ID_RT_RENAME_NAME_TABLE','en','All references to the previous table name are going to be invalid. Do you really want to change the table name?','2016-06-29') , ( 'LABEL','ID_RT_CONTINUE_TABLE_RENAME','en','Continue renaming the table','2016-06-30') ; diff --git a/workflow/engine/menus/setup.php b/workflow/engine/menus/setup.php index 50caffa9a..f0173beef 100644 --- a/workflow/engine/menus/setup.php +++ b/workflow/engine/menus/setup.php @@ -202,10 +202,10 @@ if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') === 1 && $RBAC->userCanAccess('PM_U } if ($RBAC->userCanAccess('PM_SETUP') === 1 && $RBAC->userCanAccess('PM_SETUP_LOGS') === 1) { - $G_TMP_MENU->AddIdRawOption('EVENT', '../events/eventList', G::LoadTranslation('ID_EVENTS'), '', '', 'logs'); + $G_TMP_MENU->AddIdRawOption('EVENT', '../events/eventList', G::LoadTranslation('ID_EVENTS_CLASSIC'), '', '', 'logs'); $G_TMP_MENU->AddIdRawOption( 'LOG_CASE_SCHEDULER', '../cases/cases_Scheduler_Log', - G::LoadTranslation('ID_CASE_SCHEDULER'), + G::LoadTranslation('ID_CASE_SCHEDULER_CLASSIC'), "icon-logs-list.png", '', 'logs' ); $G_TMP_MENU->AddIdRawOption("CRON", "../setup/cron", G::LoadTranslation("ID_CRON_ACTIONS"), null, null, 'logs'); From 3b6e2416ef9f72b6c410ee22df027f5cd3571d97 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Thu, 19 Oct 2017 09:46:48 -0400 Subject: [PATCH 41/85] HOR-3841 --- .../engine/content/translations/english/processmaker.en.po | 6 ++++++ workflow/engine/data/mysql/insert.sql | 3 ++- .../src/ProcessMaker/BusinessModel/ProcessPermissions.php | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/workflow/engine/content/translations/english/processmaker.en.po b/workflow/engine/content/translations/english/processmaker.en.po index bf7890e93..6f16a77e4 100644 --- a/workflow/engine/content/translations/english/processmaker.en.po +++ b/workflow/engine/content/translations/english/processmaker.en.po @@ -27869,6 +27869,12 @@ msgstr "NOT IMPORTED" msgid "CANNOT IMPORT" msgstr "CANNOT IMPORT" +# TRANSLATION +# LABEL/ID_SELECT_USER_OR_GROUP +#: LABEL/ID_SELECT_USER_OR_GROUP +msgid "Please select the name of a user or a group in the Group or User field" +msgstr "Please select the name of a user or a group in the Group or User field" + # additionalTables/additionalTablesData.xml?ADD_TAB_NAME # additionalTables/additionalTablesData.xml #: text - ADD_TAB_NAME diff --git a/workflow/engine/data/mysql/insert.sql b/workflow/engine/data/mysql/insert.sql index 524d1777b..1ae33de85 100644 --- a/workflow/engine/data/mysql/insert.sql +++ b/workflow/engine/data/mysql/insert.sql @@ -6185,7 +6185,8 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_CASE_ROUTED_TO','en','Case routed to','2017-06-02'), ( 'LABEL','ID_IMPORTED','en','IMPORTED','2017-10-03'), ( 'LABEL','ID_NOT_IMPORTED','en','NOT IMPORTED','2017-10-03'), -( 'LABEL','ID_CANNOT_IMPORT','en','CANNOT IMPORT','2017-10-03'); +( 'LABEL','ID_CANNOT_IMPORT','en','CANNOT IMPORT','2017-10-03'), +( 'LABEL','ID_SELECT_USER_OR_GROUP','en','Please select the name of a user or a group in the Group or User field','2017-10-19'); INSERT INTO ISO_LOCATION (IC_UID,IL_UID,IL_NAME,IL_NORMAL_NAME,IS_UID) VALUES ('AD','','',' ','') , diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/ProcessPermissions.php b/workflow/engine/src/ProcessMaker/BusinessModel/ProcessPermissions.php index d66b6e197..c16555636 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/ProcessPermissions.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/ProcessPermissions.php @@ -381,7 +381,7 @@ class ProcessPermissions { $usr_uid = trim($usr_uid); if ($usr_uid == '') { - throw (new \Exception(\G::LoadTranslation("ID_USER_NOT_EXIST", array('usr_uid','')))); + throw (new \Exception(\G::LoadTranslation("ID_SELECT_USER_OR_GROUP"))); } $oUsers = new \Users(); if (!($oUsers->userExists($usr_uid))) { @@ -403,7 +403,7 @@ class ProcessPermissions { $grp_uid = trim($grp_uid); if ($grp_uid == '') { - throw (new \Exception(\G::LoadTranslation("ID_GROUP_NOT_EXIST", array('grp_uid','')))); + throw (new \Exception(\G::LoadTranslation("ID_SELECT_USER_OR_GROUP"))); } $oGroup = new \Groupwf(); if (!($oGroup->GroupwfExists($grp_uid))) { From 31b12efbb5cc190a489ccbc17e7c4af38d792214 Mon Sep 17 00:00:00 2001 From: dante Date: Thu, 19 Oct 2017 10:53:56 -0400 Subject: [PATCH 42/85] HOR-3845 --- gulliver/system/class.g.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gulliver/system/class.g.php b/gulliver/system/class.g.php index 477578c59..c96681c48 100644 --- a/gulliver/system/class.g.php +++ b/gulliver/system/class.g.php @@ -1250,9 +1250,9 @@ class G $aAux = explode('/', $filename); $downloadFileName = $aAux[count($aAux) - 1]; } - header('Content-Disposition: attachment; filename="' . $downloadFileName . '"'); + header('Content-Disposition: attachment; filename="' . G::inflect($downloadFileName) . '"'); } else { - header('Content-Disposition: inline; filename="' . $downloadFileName . '"'); + header('Content-Disposition: inline; filename="' . G::inflect($downloadFileName) . '"'); } header('Content-Type: ' . $contentType); From 305585b87414910f4b07101cfbb56e4bcd912f99 Mon Sep 17 00:00:00 2001 From: dante Date: Thu, 19 Oct 2017 10:59:28 -0400 Subject: [PATCH 43/85] change to static self reference form to call methods --- gulliver/system/class.g.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gulliver/system/class.g.php b/gulliver/system/class.g.php index c96681c48..0351e5e7d 100644 --- a/gulliver/system/class.g.php +++ b/gulliver/system/class.g.php @@ -1250,9 +1250,9 @@ class G $aAux = explode('/', $filename); $downloadFileName = $aAux[count($aAux) - 1]; } - header('Content-Disposition: attachment; filename="' . G::inflect($downloadFileName) . '"'); + header('Content-Disposition: attachment; filename="' . static::inflect($downloadFileName) . '"'); } else { - header('Content-Disposition: inline; filename="' . G::inflect($downloadFileName) . '"'); + header('Content-Disposition: inline; filename="' . static::inflect($downloadFileName) . '"'); } header('Content-Type: ' . $contentType); From 11f01b8453a19230149ed634eb927fdf4f81b317 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Thu, 19 Oct 2017 11:44:31 -0400 Subject: [PATCH 44/85] HOR-3841 --- .../translations/english/processmaker.en.po | 12 ++--- .../BusinessModel/ProcessPermissions.php | 7 ++- .../Api/Project/ProcessPermissions.php | 44 +++++-------------- 3 files changed, 22 insertions(+), 41 deletions(-) diff --git a/workflow/engine/content/translations/english/processmaker.en.po b/workflow/engine/content/translations/english/processmaker.en.po index 6f16a77e4..09b966a0e 100644 --- a/workflow/engine/content/translations/english/processmaker.en.po +++ b/workflow/engine/content/translations/english/processmaker.en.po @@ -1747,6 +1747,12 @@ msgstr "Databases Source List" msgid "Changes saved" msgstr "Changes saved" +# TRANSLATION +# LABEL/ID_SELECT_USER_OR_GROUP +#: LABEL/ID_SELECT_USER_OR_GROUP +msgid "Please select the name of a user or a group in the Group or User field" +msgstr "Please select the name of a user or a group in the Group or User field" + # TRANSLATION # LABEL/ID_EMAILS #: LABEL/ID_EMAILS @@ -27869,12 +27875,6 @@ msgstr "NOT IMPORTED" msgid "CANNOT IMPORT" msgstr "CANNOT IMPORT" -# TRANSLATION -# LABEL/ID_SELECT_USER_OR_GROUP -#: LABEL/ID_SELECT_USER_OR_GROUP -msgid "Please select the name of a user or a group in the Group or User field" -msgstr "Please select the name of a user or a group in the Group or User field" - # additionalTables/additionalTablesData.xml?ADD_TAB_NAME # additionalTables/additionalTablesData.xml #: text - ADD_TAB_NAME diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/ProcessPermissions.php b/workflow/engine/src/ProcessMaker/BusinessModel/ProcessPermissions.php index c16555636..ca5a754c1 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/ProcessPermissions.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/ProcessPermissions.php @@ -224,6 +224,9 @@ class ProcessPermissions if ($opUid != '') { $opUid = $this->validateOpUid($opUid); } + if (empty($data['USR_UID']) || $data['USR_UID'] === "null") { + throw (new \Exception(\G::LoadTranslation("ID_SELECT_USER_OR_GROUP"))); + } if ($data['OP_USER_RELATION'] == "1") { $this->validateUsrUid($data['USR_UID']); } else { @@ -381,7 +384,7 @@ class ProcessPermissions { $usr_uid = trim($usr_uid); if ($usr_uid == '') { - throw (new \Exception(\G::LoadTranslation("ID_SELECT_USER_OR_GROUP"))); + throw (new \Exception(\G::LoadTranslation("ID_USER_NOT_EXIST", array('usr_uid','')))); } $oUsers = new \Users(); if (!($oUsers->userExists($usr_uid))) { @@ -403,7 +406,7 @@ class ProcessPermissions { $grp_uid = trim($grp_uid); if ($grp_uid == '') { - throw (new \Exception(\G::LoadTranslation("ID_SELECT_USER_OR_GROUP"))); + throw (new \Exception(\G::LoadTranslation("ID_GROUP_NOT_EXIST", array('grp_uid','')))); } $oGroup = new \Groupwf(); if (!($oGroup->GroupwfExists($grp_uid))) { diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Project/ProcessPermissions.php b/workflow/engine/src/ProcessMaker/Services/Api/Project/ProcessPermissions.php index 974f18116..7b023a8da 100644 --- a/workflow/engine/src/ProcessMaker/Services/Api/Project/ProcessPermissions.php +++ b/workflow/engine/src/ProcessMaker/Services/Api/Project/ProcessPermissions.php @@ -58,44 +58,22 @@ class ProcessPermissions extends Api } /** + * Creates a new Process Permission for a project. + * + * @url POST /:prj_uid/process-permission/ + * @status 201 + * * @param string $prj_uid {@min 1} {@max 32} * @param array $request_data * - * @param string $usr_uid {@from body} {@min 1} {@max 32} - * @param string $op_user_relation {@from body} {@choice 1,2} - * @param string $op_case_status {@from body} {@choice ALL,DRAFT,TO_DO,PAUSED,COMPLETED} - * @param string $op_participate {@from body} {@choice 0,1} - * @param string $op_obj_type {@from body} {@choice ANY,DYNAFORM,ATTACHMENT,INPUT,OUTPUT,CASES_NOTES,MSGS_HISTORY,SUMMARY_FORM} - * @param string $op_action {@from body} {@choice VIEW,BLOCK,DELETE,RESEND} - * @param string $tas_uid {@from body} - * @param string $op_task_source {@from body} - * @param string $dynaforms {@from body} - * @param string $inputs {@from body} - * @param string $outputs {@from body} - * - * @author Brayan Pereyra (Cochalo) - * @copyright Colosa - Bolivia - * * @return array - * - * @url POST /:prj_uid/process-permission/ - * @status 201 + * @throws RestException + * + * @access protected + * @class AccessControl {@permission PM_FACTORY} */ - public function doPostProcessPermission( - $prj_uid, - $request_data, - $usr_uid, - $op_user_relation, - $op_case_status, - $op_participate, - $op_obj_type, - $op_action, - $tas_uid = '', - $op_task_source = '', - $dynaforms = '', - $inputs = '', - $outputs = '' - ) { + public function doPostProcessPermission($prj_uid, $request_data) + { try { $hiddenFields = array('task_target', 'group_user', 'task_source', 'object_type', 'object', 'participated', 'action' From ebdeaf47552fc8e7c81d35f6202d10b0d81cc4ad Mon Sep 17 00:00:00 2001 From: Paula Quispe Date: Thu, 19 Oct 2017 13:09:17 -0400 Subject: [PATCH 45/85] . --- workflow/engine/classes/WorkspaceTools.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/workflow/engine/classes/WorkspaceTools.php b/workflow/engine/classes/WorkspaceTools.php index 52dd202cd..ddb017396 100644 --- a/workflow/engine/classes/WorkspaceTools.php +++ b/workflow/engine/classes/WorkspaceTools.php @@ -1966,13 +1966,13 @@ class WorkspaceTools $start = microtime(true); CLI::logging("> Verify License Enterprise...\n"); - //$workspace->verifyLicenseEnterprise($workspaceName); + $workspace->verifyLicenseEnterprise($workspaceName); $stop = microtime(true); CLI::logging("<*> Verify took " . ($stop - $start) . " seconds.\n"); $start = microtime(true); CLI::logging("> Check Mafe Requirements...\n"); - //$workspace->checkMafeRequirements($workspaceName, $lang); + $workspace->checkMafeRequirements($workspaceName, $lang); $stop = microtime(true); CLI::logging("<*> Check Mafe Requirements Process took " . ($stop - $start) . " seconds.\n"); From 2ce253b67f9bd182ae3c24def0301c7222ed3711 Mon Sep 17 00:00:00 2001 From: dheeyi william Date: Tue, 17 Oct 2017 16:18:26 -0400 Subject: [PATCH 46/85] FBI-2187 Translations should be available for PMDynaform --- workflow/engine/classes/model/Language.php | 221 ++++++++++-------- .../engine/templates/cases/pmdynaform.html | 1 + 2 files changed, 126 insertions(+), 96 deletions(-) diff --git a/workflow/engine/classes/model/Language.php b/workflow/engine/classes/model/Language.php index 06e6a69e7..1785e8759 100644 --- a/workflow/engine/classes/model/Language.php +++ b/workflow/engine/classes/model/Language.php @@ -121,34 +121,31 @@ class Language extends BaseLanguage } } - /* + /** * Import a language file * - * @author Erik Amaru Ortiz - * @param string $sLanguageFile - * @param string $bXml - * @return void + * @param string $languageFile + * @param bool $updateXml + * @param bool $updateDB + * @param bool $generateMafe + * @return Object + * @throws Exception */ - public function import ($sLanguageFile, $updateXml = true, $updateDB = true, $generateMafe = true) + public function import($languageFile, $updateXml = true, $updateDB = true, $generateMafe = true) { try { - - //get labels MichelangeloFE + $translation = new Translation(); try { - $oTranslation = new Translation(); - $MichelangeloFE = PATH_HOME . "../workflow/public_html/lib/js"; - if (file_exists($MichelangeloFE)) { - $labels = self::readLabelsDirectory($MichelangeloFE, true); - foreach ($labels as $label) { - $oTranslation->addTranslation('LABEL', 'ID_MAFE_' . G::encryptOld($label), 'en', $label); - } + //We get all MichelangeloFE and PMDynaform translatable labels. + $labels = array_merge(self::getLabelsMafe(), self::getLabelsPMDynaform()); + foreach ($labels as $label) { + $translation->addTranslation('LABEL', 'ID_MAFE_' . G::encryptOld($label), 'en', $label); } } catch (Exception $e) { error_log($e->getMessage()); } - - $POFile = new i18n_PO( $sLanguageFile ); + $POFile = new i18n_PO($languageFile); $POFile->readInit(); $POHeaders = $POFile->getHeaders(); @@ -156,13 +153,13 @@ class Language extends BaseLanguage $langName = $POHeaders['X-Poedit-Language']; //find the lang id $language = new Language(); - $langRecord = $language->findByLanName( $langName ); + $langRecord = $language->findByLanName($langName); - if (! isset( $langRecord['LAN_ID'] )) { - $langRecord = $language->findById( $langName ); - if (! isset( $langRecord['LAN_ID'] )) { + if (!isset($langRecord['LAN_ID'])) { + $langRecord = $language->findById($langName); + if (!isset($langRecord['LAN_ID'])) { //if the language doesn't exist abort - throw new Exception( 'The .po file has a invalid X-Poedit-Language definition!' ); + throw new Exception('The .po file has a invalid X-Poedit-Language definition!'); } } @@ -172,11 +169,11 @@ class Language extends BaseLanguage $countryName = $POHeaders['X-Poedit-Country']; if ($countryName != '.') { $isoCountry = new IsoCountry(); - $countryRecord = $isoCountry->findByIcName( $countryName ); + $countryRecord = $isoCountry->findByIcName($countryName); - if (! isset( $countryRecord['IC_UID'] )) { + if (!isset($countryRecord['IC_UID'])) { //if the language doesn't exist abort - throw new Exception( 'The .po file has a invalid X-Poedit-Country definition!' ); + throw new Exception('The .po file has a invalid X-Poedit-Country definition!'); } $countryID = $countryRecord['IC_UID']; @@ -186,23 +183,22 @@ class Language extends BaseLanguage $LOCALE = $languageID; } - $oTranslation = new Translation(); $countItems = 0; $countItemsSuccess = 0; $errorMsg = ''; while ($rowTranslation = $POFile->getTranslation()) { - $countItems ++; - if (! isset( $POFile->translatorComments[0] ) || ! isset( $POFile->translatorComments[1] ) || ! isset( $POFile->references[0] )) { - throw new Exception( 'The .po file doesn\'t have valid directives for Processmaker!' ); + $countItems++; + if (!isset($POFile->translatorComments[0]) || !isset($POFile->translatorComments[1]) || !isset($POFile->references[0])) { + throw new Exception('The .po file doesn\'t have valid directives for Processmaker!'); } foreach ($POFile->translatorComments as $a => $aux) { - $aux = trim( $aux ); + $aux = trim($aux); if ($aux == 'TRANSLATION') { $identifier = $aux; } else { - $var = explode( '/', $aux ); + $var = explode('/', $aux); if ($var[0] == 'LABEL') { $context = $aux; } @@ -210,10 +206,10 @@ class Language extends BaseLanguage $context = $aux; } } - if (preg_match( '/^([\w-]+)\/([\w-]+\/*[\w-]*\.xml\?)/', $aux, $match )) { + if (preg_match('/^([\w-]+)\/([\w-]+\/*[\w-]*\.xml\?)/', $aux, $match)) { $identifier = $aux; } else { - if (preg_match( '/^([\w-]+)\/([\w-]+\/*[\w-]*\.xml$)/', $aux, $match )) { + if (preg_match('/^([\w-]+)\/([\w-]+\/*[\w-]*\.xml$)/', $aux, $match)) { $context = $aux; } } @@ -224,10 +220,10 @@ class Language extends BaseLanguage // it is a Sql insert on TRANSLATIONS TAble if ($identifier == 'TRANSLATION') { if ($updateDB) { - list ($category, $id) = explode( '/', $context ); - $result = $oTranslation->addTranslation( $category, $id, $LOCALE, trim( stripcslashes( str_replace( chr( 10 ), '', $rowTranslation['msgstr'] ) ) ) ); + list ($category, $id) = explode('/', $context); + $result = $translation->addTranslation($category, $id, $LOCALE, trim(stripcslashes(str_replace(chr(10), '', $rowTranslation['msgstr'])))); if ($result['codError'] == 0) { - $countItemsSuccess ++; + $countItemsSuccess++; } else { $errorMsg .= $id . ': ' . $result['message'] . "\n"; } @@ -236,52 +232,52 @@ class Language extends BaseLanguage elseif ($updateXml) { $xmlForm = $context; //erik: expresion to prevent and hable correctly dropdown values like -1, -2 etc. - preg_match( '/^([\w_]+)\s-\s([\w_]+)\s*-*\s*([\w\W]*)$/', $reference, $match ); + preg_match('/^([\w_]+)\s-\s([\w_]+)\s*-*\s*([\w\W]*)$/', $reference, $match); - if (! file_exists( PATH_XMLFORM . $xmlForm )) { + if (!file_exists(PATH_XMLFORM . $xmlForm)) { $errorMsg .= 'file doesn\'t exist: ' . PATH_XMLFORM . $xmlForm . "\n"; continue; } - if (count( $match ) < 4) { - $near = isset( $rowTranslation['msgid'] ) ? $rowTranslation['msgid'] : (isset( $rowTranslation['msgstr'] ) ? $rowTranslation['msgstr'] : ''); + if (count($match) < 4) { + $near = isset($rowTranslation['msgid']) ? $rowTranslation['msgid'] : (isset($rowTranslation['msgstr']) ? $rowTranslation['msgstr'] : ''); $errorMsg .= "Invalid Translation reference: \"$reference\", near -> " . strip_tags($near) . "\n"; continue; } - $dynaform = new DynaformHandler( PATH_XMLFORM . $xmlForm ); + $dynaform = new DynaformHandler(PATH_XMLFORM . $xmlForm); $fieldName = $match[2]; - $codes = explode( '-', $reference ); + $codes = explode('-', $reference); - if (sizeof( $codes ) == 2) { + if (sizeof($codes) == 2) { //is a normal node - $dynaform->addChilds( $fieldName, Array ($LOCALE => stripcslashes( str_replace( chr( 10 ), '', $rowTranslation['msgstr'] ) ) - ) ); - } elseif (sizeof( $codes ) > 2) { + $dynaform->addChilds($fieldName, Array($LOCALE => stripcslashes(str_replace(chr(10), '', $rowTranslation['msgstr'])) + )); + } elseif (sizeof($codes) > 2) { //is a node child for a language node $name = $match[3] == "''" ? '' : $match[3]; - $childNode = Array (Array ('name' => 'option','value' => $rowTranslation['msgstr'],'attributes' => Array ('name' => $name + $childNode = Array(Array('name' => 'option', 'value' => $rowTranslation['msgstr'], 'attributes' => Array('name' => $name ) ) ); - $dynaform->addChilds( $fieldName, Array ($LOCALE => null - ), $childNode ); + $dynaform->addChilds($fieldName, Array($LOCALE => null + ), $childNode); } - $countItemsSuccess ++; + $countItemsSuccess++; } } - $oLanguage = new Language(); - $oLanguage->update( array ('LAN_ID' => $languageID,'LAN_ENABLED' => '1' - ) ); + $language = new Language(); + $language->update(array('LAN_ID' => $languageID, 'LAN_ENABLED' => '1' + )); if ($updateXml) { $trn = new Translation(); - $trn->generateFileTranslation( $LOCALE ); - $trn->addTranslationEnvironment( $LOCALE, $POHeaders, $countItemsSuccess ); + $trn->generateFileTranslation($LOCALE); + $trn->addTranslationEnvironment($LOCALE, $POHeaders, $countItemsSuccess); } if ($generateMafe) { @@ -297,26 +293,26 @@ class Language extends BaseLanguage $results->headers = $POHeaders; $results->errMsg = $errorMsg; - G::auditLog("UploadLanguage", "Language: ".$languageID); + G::auditLog("UploadLanguage", "Language: " . $languageID); return $results; - } catch (Exception $oError) { - throw ($oError); + } catch (Exception $error) { + throw ($error); } } - //export + /** + * Export language to Download + * @throws Exception + */ public function export () { - //get labels MichelangeloFE + $translation = new Translation(); try { - $oTranslation = new Translation(); - $MichelangeloFE = PATH_HOME . "../workflow/public_html/lib/js"; - if (file_exists($MichelangeloFE)) { - $labels = self::readLabelsDirectory($MichelangeloFE, true); - foreach ($labels as $label) { - $oTranslation->addTranslation('LABEL', 'ID_MAFE_' . G::encryptOld($label), 'en', $label); - } + //We get all MichelangeloFE and PMDynaform translatable labels. + $labels = array_merge(self::getLabelsMafe(), self::getLabelsPMDynaform()); + foreach ($labels as $label) { + $translation->addTranslation('LABEL', 'ID_MAFE_' . G::encryptOld($label), 'en', $label); } } catch (Exception $e) { error_log($e->getMessage()); @@ -412,8 +408,7 @@ class Language extends BaseLanguage // IF the translations id "TRN_ID" has invalid characteres or has not accepted categories if ($sTestResult[0] !== $trnCategory || ($trnCategory != 'LABEL' && $trnCategory != 'JAVASCRIPT')) { - $oTranslation = new Translation(); - $oTranslation->remove( $aRow1['TRN_CATEGORY'], $aRow1['TRN_ID'], 'en' ); //remove not accepted translations + $translation->remove( $aRow1['TRN_CATEGORY'], $aRow1['TRN_ID'], 'en' ); //remove not accepted translations continue; //jump to next iteration } @@ -561,6 +556,67 @@ class Language extends BaseLanguage G::auditLog("ExportLanguage", "Language: ".$_GET['LOCALE']); G::streamFile( $sPOFile, true ); } + + /** + * Get Labels MAFE (Michelangelo Project) + * @return array + */ + public static function getLabelsMafe() + { + $labels = []; + $buildhash = PATH_HTML . "lib/buildhash"; + if (!file_exists($buildhash)) { + throw new RuntimeException("Unable to generate labels for MAFE!.\nMissing file '{$buildhash}'."); + } + $buildhash = file_get_contents($buildhash); + + $michelangeloFE = PATH_HTML . "lib/js"; + $pathFileMafe = array_pop(glob($michelangeloFE . '/' . '*' . $buildhash . '*', GLOB_BRACE)); + if (file_exists($pathFileMafe) && is_readable($pathFileMafe)) { + $labels = self::readLabelsDirectory($pathFileMafe, true); + } + return $labels; + } + + /** + * Get Labels PMDynaform (PMDynaform Project) + * @return array + */ + public static function getLabelsPMDynaform() + { + $labels = []; + $pathFilePMDynaform = PATH_HTML . "lib/pmdynaform/build/js/PMDynaform.js"; + if (file_exists($pathFilePMDynaform) && is_readable($pathFilePMDynaform)) { + $labels = self::readLabelsDirectory($pathFilePMDynaform, true); + } + return $labels; + } + + /** + * We read all labels + * @param $path + * @param bool $unique + * @return array + */ + public static function readLabelsDirectory($path, $unique = false) + { + $labels = []; + if (is_file($path)) { + $info = pathinfo($path); + if (strtolower($info["extension"]) === "js") { + $file = file_get_contents($path); + //search string 'xx\'xx\'xx'.translate() + $labels = array_merge($labels, self::readLabelsFile($file, "'")); + //search string "xx\"xx\"xx".translate() + $labels = array_merge($labels, self::readLabelsFile($file, "\"")); + } + } + if ($unique) { + $labels = array_unique($labels); + } + return $labels; + } + public function updateLanguagePlugin ($plugin, $idLanguage) { if (!file_exists(PATH_PLUGINS . $plugin)) { @@ -835,33 +891,6 @@ class Language extends BaseLanguage } //end foreach } } - - public static function readLabelsDirectory($path, $unique = false) - { - $labels = array(); - $items = opendir($path); - while (false !== ($item = readdir($items))) { - $a = $path . "/" . $item; - if ($item !== "." && $item !== ".." && is_dir($a)) { - $labels = array_merge($labels, self::readLabelsDirectory($a, false)); - } - if (is_file($a)) { - $info = pathinfo($a); - if ($info["extension"] === "js" || $info["extension"] === "JS") { - $file = file_get_contents($a); - //search string 'xx\'xx\'xx'.translate() - $labels = array_merge($labels, self::readLabelsFile($file, "'")); - //search string "xx\"xx\"xx".translate() - $labels = array_merge($labels, self::readLabelsFile($file, "\"")); - } - } - } - if ($unique) { - $labels = array_unique($labels); - } - closedir($items); - return $labels; - } public static function readLabelsFile($file, $sep) { diff --git a/workflow/engine/templates/cases/pmdynaform.html b/workflow/engine/templates/cases/pmdynaform.html index e593e3597..fd91d6578 100644 --- a/workflow/engine/templates/cases/pmdynaform.html +++ b/workflow/engine/templates/cases/pmdynaform.html @@ -12,6 +12,7 @@ + From 4ec3e2a90a8a70732f2ba81a0892377b61944bf6 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Thu, 19 Oct 2017 15:54:42 -0400 Subject: [PATCH 47/85] HOR-3841 --- .../src/ProcessMaker/BusinessModel/ProcessPermissions.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/ProcessPermissions.php b/workflow/engine/src/ProcessMaker/BusinessModel/ProcessPermissions.php index ca5a754c1..862907bd8 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/ProcessPermissions.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/ProcessPermissions.php @@ -5,6 +5,7 @@ use Behat\Behat\Exception\Exception; use \G; use \Criteria; use \ObjectPermissionPeer; +use \Exception as StandardException; /** * @author Brayan Pereyra (Cochalo) @@ -224,8 +225,8 @@ class ProcessPermissions if ($opUid != '') { $opUid = $this->validateOpUid($opUid); } - if (empty($data['USR_UID']) || $data['USR_UID'] === "null") { - throw (new \Exception(\G::LoadTranslation("ID_SELECT_USER_OR_GROUP"))); + if (empty($data['USR_UID']) || (isset($data['USR_UID']) && $data['USR_UID'] === "null")) { + throw (new StandardException(G::LoadTranslation("ID_SELECT_USER_OR_GROUP"))); } if ($data['OP_USER_RELATION'] == "1") { $this->validateUsrUid($data['USR_UID']); From 21e1912fd507e2e0b1b80ea66890274a0ec441f4 Mon Sep 17 00:00:00 2001 From: dante Date: Fri, 20 Oct 2017 14:38:08 -0400 Subject: [PATCH 48/85] moving sanitization to file names of output documents only --- gulliver/system/class.g.php | 4 ++-- workflow/engine/methods/cases/cases_ShowOutputDocument.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gulliver/system/class.g.php b/gulliver/system/class.g.php index 1b5b41ffe..096906d9b 100644 --- a/gulliver/system/class.g.php +++ b/gulliver/system/class.g.php @@ -1250,9 +1250,9 @@ class G $aAux = explode('/', $filename); $downloadFileName = $aAux[count($aAux) - 1]; } - header('Content-Disposition: attachment; filename="' . static::inflect($downloadFileName) . '"'); + header('Content-Disposition: attachment; filename="' . $downloadFileName . '"'); } else { - header('Content-Disposition: inline; filename="' . static::inflect($downloadFileName) . '"'); + header('Content-Disposition: inline; filename="' . $downloadFileName . '"'); } header('Content-Type: ' . $contentType); diff --git a/workflow/engine/methods/cases/cases_ShowOutputDocument.php b/workflow/engine/methods/cases/cases_ShowOutputDocument.php index 9436daea4..b9566e088 100644 --- a/workflow/engine/methods/cases/cases_ShowOutputDocument.php +++ b/workflow/engine/methods/cases/cases_ShowOutputDocument.php @@ -159,7 +159,7 @@ if (!$sw_file_exists) { } /*----------------------------------********---------------------------------*/ if (!$downloadStatus) { - G::streamFile( $realPath, $download, $nameFile); //download + G::streamFile( $realPath, $download, G::inflect( $nameFile)); //download } } } From e9697990e6be8ea070092e1f27dbc5cd232bf005 Mon Sep 17 00:00:00 2001 From: dante Date: Fri, 20 Oct 2017 14:50:17 -0400 Subject: [PATCH 49/85] moving file name sanitization to ouput document files only --- workflow/engine/methods/cases/cases_ShowOutputDocument.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow/engine/methods/cases/cases_ShowOutputDocument.php b/workflow/engine/methods/cases/cases_ShowOutputDocument.php index b9566e088..b786e3814 100644 --- a/workflow/engine/methods/cases/cases_ShowOutputDocument.php +++ b/workflow/engine/methods/cases/cases_ShowOutputDocument.php @@ -159,7 +159,7 @@ if (!$sw_file_exists) { } /*----------------------------------********---------------------------------*/ if (!$downloadStatus) { - G::streamFile( $realPath, $download, G::inflect( $nameFile)); //download + G::streamFile( $realPath, $download, G::inflect($nameFile)); //download } } } From 4173cfac478bdc50e7a7dacd1ebb373ff507b82e Mon Sep 17 00:00:00 2001 From: Paula Quispe Date: Fri, 20 Oct 2017 17:01:58 -0400 Subject: [PATCH 50/85] HOR-3784 --- workflow/engine/classes/WorkspaceTools.php | 27 ++++++++++++---------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/workflow/engine/classes/WorkspaceTools.php b/workflow/engine/classes/WorkspaceTools.php index ddb017396..c958a08eb 100644 --- a/workflow/engine/classes/WorkspaceTools.php +++ b/workflow/engine/classes/WorkspaceTools.php @@ -614,19 +614,22 @@ class WorkspaceTools $blackList = unserialize($configData['CFG_VALUE']); } - $content = $this->getListContentMigrateTable(); - - foreach ($content as $className => $fields) { - //We check if all the label was migrated from content table - if (!in_array($className, $blackList)) { - $executeRegenerateContent = true; - break; + if (count($blackList) > 0) { + //If we have the flag MIGRATED_CONTENT we will check the $blackList + $content = $this->getListContentMigrateTable(); + foreach ($content as $className => $fields) { + //We check if all the label was migrated from content table + if (!in_array($className, $blackList)) { + $executeRegenerateContent = true; + break; + } + } + } else { + //If the flag does not exist we will check over the schema + //The $lastContentMigrateTable return false if we need to force regenerate content + if (!$this->getLastContentMigrateTable()) { + $executeRegenerateContent = true; } - } - - //The $lastContentMigrateTable return false if we need to force regenerate content - if (!$this->getLastContentMigrateTable()) { - $executeRegenerateContent = true; } } From 07a04d472a41402b222bfa2b7b1ee2e10c0bf8d4 Mon Sep 17 00:00:00 2001 From: Paula Quispe Date: Mon, 23 Oct 2017 09:02:58 -0400 Subject: [PATCH 51/85] Upper --- workflow/engine/classes/WorkspaceTools.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow/engine/classes/WorkspaceTools.php b/workflow/engine/classes/WorkspaceTools.php index c958a08eb..a6ddadb55 100644 --- a/workflow/engine/classes/WorkspaceTools.php +++ b/workflow/engine/classes/WorkspaceTools.php @@ -635,7 +635,7 @@ class WorkspaceTools //We will to regenerate the Content table if ($executeRegenerateContent) { - CLI::logging("-> Start To update...\n"); + CLI::logging("-> Start To Update...\n"); $translation = new Translation(); $information = $translation->getTranslationEnvironments(); $arrayLang = []; From 01dcc8606e5bced125d826ac8cd8dc5d59e1a5f5 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Mon, 23 Oct 2017 11:52:43 -0400 Subject: [PATCH 52/85] HOR-1717 --- workflow/engine/templates/pmTables/editReport.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow/engine/templates/pmTables/editReport.js b/workflow/engine/templates/pmTables/editReport.js index ad419faf9..c35c47276 100644 --- a/workflow/engine/templates/pmTables/editReport.js +++ b/workflow/engine/templates/pmTables/editReport.js @@ -1157,7 +1157,7 @@ function createReportTable() } //validate process - PRO_UID = (PRO_UID !== false) ? PRO_UID : ((Ext.getCmp('PROCESS').getValue().trim() != '') ? Ext.getCmp('PROCESS').getValue().trim() : ''); + PRO_UID = (PRO_UID !== false && PRO_UID !== "") ? PRO_UID : ((Ext.getCmp('PROCESS').getValue().trim() != '') ? Ext.getCmp('PROCESS').getValue().trim() : ''); if(PRO_UID == '') { Ext.getCmp('PROCESS').focus(); PMExt.error(_('ID_ERROR'), _('ID_PROCESS_IS_REQUIRED'), function(){ From e0aa6a11dc79f9738589baf87993bb366f0ca81b Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Mon, 23 Oct 2017 12:35:23 -0400 Subject: [PATCH 53/85] HOR-1717 --- workflow/engine/templates/pmTables/editReport.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/workflow/engine/templates/pmTables/editReport.js b/workflow/engine/templates/pmTables/editReport.js index c35c47276..2d478acc6 100644 --- a/workflow/engine/templates/pmTables/editReport.js +++ b/workflow/engine/templates/pmTables/editReport.js @@ -972,10 +972,10 @@ function validateFieldSizeAutoincrement(valueType, defaultValue) { var dataStoreAux = types.getRange(0); comboReport.setValue(dataStoreAux[0].data.REP_TAB_TYPE); comboGridsList.setVisible(false); - - comboDbConnections.getStore().reload({params: {PRO_UID: Ext.getCmp("PROCESS").getValue()}}); + PRO_UID = Ext.getCmp('PROCESS').getValue().trim(); + comboDbConnections.getStore().reload({params: {PRO_UID: PRO_UID}}); if (Ext.getCmp('REP_TAB_TYPE').getValue() == 'GRID') { - gridsListStore.reload({params:{PRO_UID : Ext.getCmp('PROCESS').getValue()}}); + gridsListStore.reload({params: {PRO_UID: PRO_UID}}); } else { loadFieldNormal(); } From 99278dfa78998d195b0a653866a139a9708c45e8 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Mon, 23 Oct 2017 12:42:09 -0400 Subject: [PATCH 54/85] HOR-1717 --- .../engine/templates/pmTables/editReport.js | 2789 ++++++++--------- 1 file changed, 1378 insertions(+), 1411 deletions(-) diff --git a/workflow/engine/templates/pmTables/editReport.js b/workflow/engine/templates/pmTables/editReport.js index 2d478acc6..8550da40f 100644 --- a/workflow/engine/templates/pmTables/editReport.js +++ b/workflow/engine/templates/pmTables/editReport.js @@ -1,11 +1,6 @@ -/** - * Report tables New/Edit - * @author Erik A. O. - */ - //grids define var availableGrid; -var selCombo=''; +var selCombo = ''; var assignedGrid; var editor; // row editor for assignedGrid @@ -18,263 +13,262 @@ var removeButton; var removeAllButton; var tmp1 = new Array(); var pageSize = 50; -var mainMask = new Ext.LoadMask(Ext.getBody(), {msg: _('ID_PLEASE_WAIT') }); +var mainMask = new Ext.LoadMask(Ext.getBody(), {msg: _('ID_PLEASE_WAIT')}); var bbarpaging; //main -Ext.onReady(function(){ - mainMask = new Ext.LoadMask(Ext.getBody(), {msg: _('ID_PLEASE_WAIT') }); - var fm = Ext.form; - var fieldsCount = 0; +Ext.onReady(function () { + mainMask = new Ext.LoadMask(Ext.getBody(), {msg: _('ID_PLEASE_WAIT')}); + var fm = Ext.form; + var fieldsCount = 0; - // store for available fields grid - storeA = new Ext.data.GroupingStore( { - proxy : new Ext.data.HttpProxy({ - url: '../pmTablesProxy/getDynafields' - }), - reader : new Ext.data.JsonReader( { - root: 'rows', - totalProperty: 'count', - fields : [ - {name : 'FIELD_UID'}, - {name : 'FIELD_VALIDATE'}, - {name : 'FIELD_NAME'}, - {name : '_index'}, - {name : '_isset'} - ] - }), - listeners: { - beforeload: function (store, options) - { - var p = {PRO_UID: (PRO_UID !== false)? PRO_UID : Ext.getCmp("PROCESS").getValue()}; + // store for available fields grid + storeA = new Ext.data.GroupingStore({ + proxy: new Ext.data.HttpProxy({ + url: '../pmTablesProxy/getDynafields' + }), + reader: new Ext.data.JsonReader({ + root: 'rows', + totalProperty: 'count', + fields: [ + {name: 'FIELD_UID'}, + {name: 'FIELD_VALIDATE'}, + {name: 'FIELD_NAME'}, + {name: '_index'}, + {name: '_isset'} + ] + }), + listeners: { + beforeload: function (store, options) + { + var p = {PRO_UID: (PRO_UID !== false) ? PRO_UID : Ext.getCmp("PROCESS").getValue()}; - if (Ext.getCmp("REP_TAB_TYPE").getValue() == "GRID" && Ext.getCmp("REP_TAB_GRID").getValue() != "") { - p.TYPE = "GRID"; - p.GRID_UID = Ext.getCmp("REP_TAB_GRID").getValue(); + if (Ext.getCmp("REP_TAB_TYPE").getValue() == "GRID" && Ext.getCmp("REP_TAB_GRID").getValue() != "") { + p.TYPE = "GRID"; + p.GRID_UID = Ext.getCmp("REP_TAB_GRID").getValue(); + } + + if (Ext.getCmp("searchTxt").getValue() != "") { + p.textFilter = Ext.getCmp("searchTxt").getValue(); + } + + this.baseParams = p; + }, + load: function () { + Ext.getCmp('availableGrid').store.sort(); + storeA.setBaseParam('PRO_UID', (PRO_UID !== false ? PRO_UID : Ext.getCmp('PROCESS').getValue())); + mainMask.hide(); + assignedGrid._setTitle(); } - - if (Ext.getCmp("searchTxt").getValue() != "") { - p.textFilter = Ext.getCmp("searchTxt").getValue(); - } - - this.baseParams = p; }, - load: function() { - Ext.getCmp('availableGrid').store.sort(); - storeA.setBaseParam('PRO_UID', (PRO_UID !== false? PRO_UID : Ext.getCmp('PROCESS').getValue())); - mainMask.hide(); - assignedGrid._setTitle(); - } - }, - baseParams: { - PRO_UID: '' - }, - remoteSort: false - }); + baseParams: { + PRO_UID: '' + }, + remoteSort: false + }); - storeA.setDefaultSort('FIELD_NAME', 'asc'); + storeA.setDefaultSort('FIELD_NAME', 'asc'); - //column model for available fields grid - cmodelA = new Ext.grid.ColumnModel({ - defaults: { - width: 55, - sortable: true - }, - columns: [ - { - id:'FIELD_UID', - dataIndex: 'FIELD_UID', - hidden:true, - hideable:false - }, { - dataIndex:'FIELD_VALIDATE', - hidden:true, - hideable:false - } - , { - dataIndex:'_index', - hidden:true, - hideable:false - }, { - dataIndex:'_isset', - hidden:true, - hideable:false - }, { - header : _("ID_DYNAFORM_FIELDS"), - dataIndex : 'FIELD_NAME', - sortable : true, - align:'left' - } - ] - }); - //selection model for available fields grid - smodelA = new Ext.grid.RowSelectionModel({ - selectSingle: false, - listeners:{ - selectionchange: function(sm){ - switch(sm.getCount()){ - case 0: Ext.getCmp('assignButton').disable(); break; - default: Ext.getCmp('assignButton').enable(); break; - } - } - } - }); - - - storePageSize = new Ext.data.SimpleStore({ - fields: ['size'], - data: [['20'],['30'],['40'],['50'],['100']], - autoLoad: true - }); - - comboPageSize = new Ext.form.ComboBox({ - typeAhead : false, - mode : 'local', - triggerAction : 'all', - store: storePageSize, - valueField: 'size', - displayField: 'size', - width: 50, - editable: false, - listeners:{ - select: function(c,d,i){ - //UpdatePageConfig(d.data['size']); - bbarpaging.pageSize = parseInt(d.data['size']); - bbarpaging.moveFirst(); - } - } - }); - - comboPageSize.setValue(pageSize); - - bbarpaging = new Ext.PagingToolbar({ - id: 'editReportBbarpaging', - pageSize: pageSize, - store: storeA, - displayInfo: true, - displayMsg: '{0} - {1} ' + _('ID_DISPLAY_OF') + ' {2}', - emptyMsg: _('ID_NO_RECORDS')/*, - items: ['-',_('ID_PAGE_SIZE')+':',comboPageSize]*/ - }); - - //grid for table columns grid - availableGrid = new Ext.grid.GridPanel({ - layout : 'fit', - region : 'center', - id : 'availableGrid', - ddGroup : 'assignedGridDDGroup', - enableDragDrop : true, - stripeRows : true, - autoWidth : true, - stripeRows : true, - height : 100, - width : 290, - stateful : true, - stateId : 'gridEditReport', - enableHdMenu : false, - columnLines : false, - viewConfig : {forceFit:true}, - cm : cmodelA, - sm : smodelA, - store : storeA, - //loadMask: {message:'Loading...'}, - listeners : { - rowdblclick: AssignFieldsAction - }, - tbar: [ - { - xtype: 'textfield', - id: 'searchTxt', - ctCls:'pm_search_text_field', - allowBlank: true, - width: 220, - emptyText: _('ID_EMPTY_SEARCH'), - listeners: { - specialkey: function(f,e){ - if (e.getKey() == e.ENTER) { - filterAvFields(); - } + //column model for available fields grid + cmodelA = new Ext.grid.ColumnModel({ + defaults: { + width: 55, + sortable: true + }, + columns: [ + { + id: 'FIELD_UID', + dataIndex: 'FIELD_UID', + hidden: true, + hideable: false + }, { + dataIndex: 'FIELD_VALIDATE', + hidden: true, + hideable: false + } + , { + dataIndex: '_index', + hidden: true, + hideable: false + }, { + dataIndex: '_isset', + hidden: true, + hideable: false + }, { + header: _("ID_DYNAFORM_FIELDS"), + dataIndex: 'FIELD_NAME', + sortable: true, + align: 'left' + } + ] + }); + //selection model for available fields grid + smodelA = new Ext.grid.RowSelectionModel({ + selectSingle: false, + listeners: { + selectionchange: function (sm) { + switch (sm.getCount()) { + case 0: + Ext.getCmp('assignButton').disable(); + break; + default: + Ext.getCmp('assignButton').enable(); + break; + } } - } - }, - { - id: 'availableGridButtonClear', - text: 'X', - ctCls:'pm_search_x_button', - handler: function(){ - Ext.getCmp('searchTxt').setValue(''); - filterAvFields(); } - }, { - id: 'availableGridButtonSearch', - text: _('ID_FILTER'), - handler: function(){ - filterAvFields(); + }); + + + storePageSize = new Ext.data.SimpleStore({ + fields: ['size'], + data: [['20'], ['30'], ['40'], ['50'], ['100']], + autoLoad: true + }); + + comboPageSize = new Ext.form.ComboBox({ + typeAhead: false, + mode: 'local', + triggerAction: 'all', + store: storePageSize, + valueField: 'size', + displayField: 'size', + width: 50, + editable: false, + listeners: { + select: function (c, d, i) { + bbarpaging.pageSize = parseInt(d.data['size']); + bbarpaging.moveFirst(); + } } - } - ], - bbar: bbarpaging - }); + }); - var filterAvFields = function() { - //availableGrid.store.load({params: {textFilter: Ext.getCmp('searchTxt').getValue()}}); - //storeA.setParam('textFilter', Ext.getCmp('searchTxt').getValue()); - storeA.reload({params: {textFilter: Ext.getCmp('searchTxt').getValue(), start: bbarpaging.cursor, limit: pageSize}}); - } + comboPageSize.setValue(pageSize); - //selecion model for table columns grid - sm = new Ext.grid.RowSelectionModel({ - selectSingle: false, - listeners:{ - rowselect: function(sm) { - validateFieldSizeAutoincrement(assignedGrid.getSelectionModel().getSelected().get('field_type'), false); - }, - selectionchange: function(sm){ - switch(sm.getCount()){ - case 0: - Ext.getCmp('removeButton').disable(); - Ext.getCmp('removeColumn').disable(); - break; - case 1: - var record = Ext.getCmp('assignedGrid').getSelectionModel().getSelected(); - Ext.getCmp('removeButton').enable(); + bbarpaging = new Ext.PagingToolbar({ + id: 'editReportBbarpaging', + pageSize: pageSize, + store: storeA, + displayInfo: true, + displayMsg: '{0} - {1} ' + _('ID_DISPLAY_OF') + ' {2}', + emptyMsg: _('ID_NO_RECORDS') + }); - if (record.data.field_dyn == '' && record.data.field_name != 'APP_UID' && record.data.field_name != 'APP_NUMBER' && record.data.field_name != 'ROW') { - Ext.getCmp('removeColumn').enable(); - } - break; - default: - Ext.getCmp('removeButton').enable(); - Ext.getCmp('removeColumn').disable(); - break; - } - } - } - }); - //check column for table columns grid - var checkColumn = new Ext.grid.CheckColumn({ - header: 'Filter', - dataIndex: 'FIELD_FILTER', - id: 'FIELD_FILTER', - width: 55 - }); - - var sizeField = new fm.NumberField({ - name: 'sizeEdit', - id: 'sizeEdit', - allowBlank: true, - allowDecimals: false, - allowNegative: false, - disabled: true, - nanText: 'This field should content a number', - minValue: 1, - maxValue: 99, - minLength: 0, - listeners:{ - render:function(){ - validateFieldSizeAutoincrement(assignedGrid.getSelectionModel().getSelected().get('field_type'), false); + //grid for table columns grid + availableGrid = new Ext.grid.GridPanel({ + layout: 'fit', + region: 'center', + id: 'availableGrid', + ddGroup: 'assignedGridDDGroup', + enableDragDrop: true, + stripeRows: true, + autoWidth: true, + stripeRows: true, + height: 100, + width: 290, + stateful: true, + stateId: 'gridEditReport', + enableHdMenu: false, + columnLines: false, + viewConfig: {forceFit: true}, + cm: cmodelA, + sm: smodelA, + store: storeA, + listeners: { + rowdblclick: AssignFieldsAction + }, + tbar: [ + { + xtype: 'textfield', + id: 'searchTxt', + ctCls: 'pm_search_text_field', + allowBlank: true, + width: 220, + emptyText: _('ID_EMPTY_SEARCH'), + listeners: { + specialkey: function (f, e) { + if (e.getKey() == e.ENTER) { + filterAvFields(); } - } - }); + } + } + }, + { + id: 'availableGridButtonClear', + text: 'X', + ctCls: 'pm_search_x_button', + handler: function () { + Ext.getCmp('searchTxt').setValue(''); + filterAvFields(); + } + }, { + id: 'availableGridButtonSearch', + text: _('ID_FILTER'), + handler: function () { + filterAvFields(); + } + } + ], + bbar: bbarpaging + }); + + var filterAvFields = function () { + storeA.reload({params: {textFilter: Ext.getCmp('searchTxt').getValue(), start: bbarpaging.cursor, limit: pageSize}}); + } + + //selecion model for table columns grid + sm = new Ext.grid.RowSelectionModel({ + selectSingle: false, + listeners: { + rowselect: function (sm) { + validateFieldSizeAutoincrement(assignedGrid.getSelectionModel().getSelected().get('field_type'), false); + }, + selectionchange: function (sm) { + switch (sm.getCount()) { + case 0: + Ext.getCmp('removeButton').disable(); + Ext.getCmp('removeColumn').disable(); + break; + case 1: + var record = Ext.getCmp('assignedGrid').getSelectionModel().getSelected(); + Ext.getCmp('removeButton').enable(); + + if (record.data.field_dyn == '' && record.data.field_name != 'APP_UID' && record.data.field_name != 'APP_NUMBER' && record.data.field_name != 'ROW') { + Ext.getCmp('removeColumn').enable(); + } + break; + default: + Ext.getCmp('removeButton').enable(); + Ext.getCmp('removeColumn').disable(); + break; + } + } + } + }); + //check column for table columns grid + var checkColumn = new Ext.grid.CheckColumn({ + header: 'Filter', + dataIndex: 'FIELD_FILTER', + id: 'FIELD_FILTER', + width: 55 + }); + + var sizeField = new fm.NumberField({ + name: 'sizeEdit', + id: 'sizeEdit', + allowBlank: true, + allowDecimals: false, + allowNegative: false, + disabled: true, + nanText: 'This field should content a number', + minValue: 1, + maxValue: 99, + minLength: 0, + listeners: { + render: function () { + validateFieldSizeAutoincrement(assignedGrid.getSelectionModel().getSelected().get('field_type'), false); + } + } + }); //columns for table columns grid @@ -283,41 +277,41 @@ Ext.onReady(function(){ id: 'uid', dataIndex: 'uid', hidden: true, - hideable:false + hideable: false }, { dataIndex: '_index', hidden: true, - hideable:false + hideable: false }, { dataIndex: '_isset', hidden: true, - hideable:false + hideable: false }, { id: 'field_uid', dataIndex: 'field_uid', hidden: true, - hideable:false + hideable: false }, { id: 'field_key', dataIndex: 'field_key', hidden: true, - hideable:false + hideable: false }, { id: 'field_index', dataIndex: 'field_index', hidden: true, - hideable:false + hideable: false }, { id: 'field_null', dataIndex: 'field_null', hidden: true, - hideable:false + hideable: false }, { id: 'field_dyn', @@ -326,8 +320,8 @@ Ext.onReady(function(){ width: 220, // use shorthand alias defined above editor: { - xtype: 'displayfield', - style: 'font-size:11px; padding-left:7px' + xtype: 'displayfield', + style: 'font-size:11px; padding-left:7px' } }, { id: 'field_name', @@ -335,22 +329,22 @@ Ext.onReady(function(){ dataIndex: 'field_name', width: 220, editor: { - xtype: 'textfield', - allowBlank: true, - listeners:{ - change: function(f,e){ - this.setValue(this.getValue().toUpperCase()); + xtype: 'textfield', + allowBlank: true, + listeners: { + change: function (f, e) { + this.setValue(this.getValue().toUpperCase()); + } } - } } }, { id: 'field_label', header: _("ID_FIELD_LABEL"), dataIndex: 'field_label', width: 220, - editor:{ - xtype: 'textfield', - allowBlank: true + editor: { + xtype: 'textfield', + allowBlank: true } }, { id: 'field_type', @@ -363,13 +357,12 @@ Ext.onReady(function(){ editable: false, lazyRender: true, mode: 'local', - displayField:'type', - valueField:'type_id', + displayField: 'type', + valueField: 'type_id', store: new Ext.data.SimpleStore({ fields: ['type_id', 'type'], - //data : [['VARCHAR',_("ID_VARCHAR")],['TEXT',_("ID_TEXT")],['DATE',_("ID_DATE")],['INT',_("ID_INT")],['FLOAT',_("ID_FLOAT")]], data: columnsTypes, - sortInfo: {field:'type_id', direction:'ASC'} + sortInfo: {field: 'type_id', direction: 'ASC'} }), listeners: { beforerender: function (combo) @@ -384,20 +377,20 @@ Ext.onReady(function(){ combo.setValue(combo.store.getAt(0).get(combo.valueField)); } }, - 'select': function(combo, row, index) { - if (cm && cm instanceof Ext.grid.ColumnModel) { - var valueCombo = combo.getValue(); - var changeValue = !(valueCombo === assignedGrid.getSelectionModel().getSelected().get('field_type')); - validateFieldSizeAutoincrement(valueCombo, changeValue); - var fieldTypeValue = combo.getValue(); - var fieldIndex = Ext.getCmp("field_index"); - var fieldInc = Ext.getCmp("field_incre"); - var sizeEdit = Ext.getCmp("sizeEdit"); + 'select': function (combo, row, index) { + if (cm && cm instanceof Ext.grid.ColumnModel) { + var valueCombo = combo.getValue(); + var changeValue = !(valueCombo === assignedGrid.getSelectionModel().getSelected().get('field_type')); + validateFieldSizeAutoincrement(valueCombo, changeValue); + var fieldTypeValue = combo.getValue(); + var fieldIndex = Ext.getCmp("field_index"); + var fieldInc = Ext.getCmp("field_incre"); + var sizeEdit = Ext.getCmp("sizeEdit"); - editorFieldsEnableDisable(fieldTypeValue, fieldIndex, fieldInc, sizeEdit); + editorFieldsEnableDisable(fieldTypeValue, fieldIndex, fieldInc, sizeEdit); - flagShowMessageError = 1; - } + flagShowMessageError = 1; + } }//select } }) @@ -410,19 +403,19 @@ Ext.onReady(function(){ editor: sizeField }, { - xtype: 'booleancolumn', - header: _('ID_AUTO_INCREMENT'), - dataIndex: 'field_autoincrement', - align: 'center', - width: 100, - trueText: _('ID_YES'), - falseText: _('ID_NO'), - editor: { - xtype: 'checkbox', - id: 'field_incre', - disabled: true, - inputValue: 'always' - } + xtype: 'booleancolumn', + header: _('ID_AUTO_INCREMENT'), + dataIndex: 'field_autoincrement', + align: 'center', + width: 100, + trueText: _('ID_YES'), + falseText: _('ID_NO'), + editor: { + xtype: 'checkbox', + id: 'field_incre', + disabled: true, + inputValue: 'always' + } } /*----------------------------------********---------------------------------*/ , { @@ -441,874 +434,849 @@ Ext.onReady(function(){ } } /*----------------------------------********---------------------------------*/ - ]; + ]; -function validateFieldSizeAutoincrement(valueType, defaultValue) { - if (Ext.getCmp("sizeEdit").getEl()) { + function validateFieldSizeAutoincrement(valueType, defaultValue) { + if (Ext.getCmp("sizeEdit").getEl()) { - if (valueType === 'INTEGER' || valueType === 'BIGINT' || valueType === 'SMALLINT' || valueType === 'TINYINT') { - Ext.getCmp("sizeEdit").enable(); - Ext.getCmp("sizeEdit").setMaxValue(99); - Ext.getCmp("sizeEdit").getEl().dom.maxLength = 2; - if (defaultValue) { - Ext.getCmp("sizeEdit").setValue(''); + if (valueType === 'INTEGER' || valueType === 'BIGINT' || valueType === 'SMALLINT' || valueType === 'TINYINT') { + Ext.getCmp("sizeEdit").enable(); + Ext.getCmp("sizeEdit").setMaxValue(99); + Ext.getCmp("sizeEdit").getEl().dom.maxLength = 2; + if (defaultValue) { + Ext.getCmp("sizeEdit").setValue(''); + } + + Ext.getCmp("field_incre").enable(); + if (defaultValue) { + Ext.getCmp("field_incre").setValue(false); + } } - Ext.getCmp("field_incre").enable(); - if (defaultValue) { + if (valueType === 'CHAR' || valueType === 'VARCHAR' || valueType === 'LONGVARCHAR') { + Ext.getCmp("sizeEdit").enable(); + Ext.getCmp("sizeEdit").setMaxValue(((valueType === 'CHAR') ? 255 : 999)); + Ext.getCmp("sizeEdit").getEl().dom.maxLength = 3; + if (defaultValue) { + Ext.getCmp("sizeEdit").setValue(''); + } + + Ext.getCmp("field_incre").disable(); + Ext.getCmp("field_incre").setValue(false); + } + + if (valueType === 'BOOLEAN' || valueType === 'DATE' || valueType === 'DATETIME' || valueType === 'TIME' || valueType === 'DECIMAL' || valueType === 'DOUBLE' || valueType === 'FLOAT' || valueType === 'REAL') { + Ext.getCmp("sizeEdit").disable(); + Ext.getCmp("sizeEdit").setValue(''); + + Ext.getCmp("field_incre").disable(); Ext.getCmp("field_incre").setValue(false); } } - - if (valueType === 'CHAR' || valueType === 'VARCHAR' || valueType === 'LONGVARCHAR') { - Ext.getCmp("sizeEdit").enable(); - Ext.getCmp("sizeEdit").setMaxValue(((valueType === 'CHAR') ? 255 : 999)); - Ext.getCmp("sizeEdit").getEl().dom.maxLength = 3; - if (defaultValue) { - Ext.getCmp("sizeEdit").setValue(''); - } - - Ext.getCmp("field_incre").disable(); - Ext.getCmp("field_incre").setValue(false); - } - - if (valueType === 'BOOLEAN' || valueType === 'DATE' || valueType === 'DATETIME' || valueType === 'TIME' || valueType === 'DECIMAL' || valueType === 'DOUBLE' || valueType === 'FLOAT' || valueType === 'REAL') { - Ext.getCmp("sizeEdit").disable(); - Ext.getCmp("sizeEdit").setValue(''); - - Ext.getCmp("field_incre").disable(); - Ext.getCmp("field_incre").setValue(false); - } } -} - //if permissions plugin is enabled - if (TABLE !== false && TABLE.ADD_TAB_TAG == 'plugin@simplereport') { - cmColumns.push({ - xtype: 'booleancolumn', - header: 'Filter', - dataIndex: 'field_filter', - align: 'center', - width: 50, - trueText: _('ID_YES'), - falseText: _('ID_NO'), - editor: { - xtype: 'checkbox' - } - }) - } + //if permissions plugin is enabled + if (TABLE !== false && TABLE.ADD_TAB_TAG == 'plugin@simplereport') { + cmColumns.push({ + xtype: 'booleancolumn', + header: 'Filter', + dataIndex: 'field_filter', + align: 'center', + width: 50, + trueText: _('ID_YES'), + falseText: _('ID_NO'), + editor: { + xtype: 'checkbox' + } + }) + } - //column model for table columns grid - var cm = new Ext.grid.ColumnModel({ - // specify any defaults for each column - defaults: { - resizable: false, - sortable: true // columns are not sortable by default - }, - columns:cmColumns - }); - //store for table columns grid - store = new Ext.data.ArrayStore({ - fields: [ - {name: 'uid', type: 'string'}, - {name: '_index'}, - {name: '_isset'}, - {name: 'field_uid', type: 'string'}, - {name: 'field_key', type: 'string'}, - {name: 'field_index', type: 'string'}, - {name: 'field_name', type: 'string'}, - {name: 'field_label', type: 'string'}, - {name: 'field_type'}, - {name: 'field_size', type: 'float'}, - {name: 'field_null', type: 'float'}, - {name: 'field_autoincrement', type: 'float'}, - {name: 'field_filter', type: 'string'} - ] - }); - //row editor for table columns grid - var flagShowMessageError = 1; + //column model for table columns grid + var cm = new Ext.grid.ColumnModel({ + // specify any defaults for each column + defaults: { + resizable: false, + sortable: true // columns are not sortable by default + }, + columns: cmColumns + }); + //store for table columns grid + store = new Ext.data.ArrayStore({ + fields: [ + {name: 'uid', type: 'string'}, + {name: '_index'}, + {name: '_isset'}, + {name: 'field_uid', type: 'string'}, + {name: 'field_key', type: 'string'}, + {name: 'field_index', type: 'string'}, + {name: 'field_name', type: 'string'}, + {name: 'field_label', type: 'string'}, + {name: 'field_type'}, + {name: 'field_size', type: 'float'}, + {name: 'field_null', type: 'float'}, + {name: 'field_autoincrement', type: 'float'}, + {name: 'field_filter', type: 'string'} + ] + }); + //row editor for table columns grid + var flagShowMessageError = 1; - editor = new Ext.ux.grid.RowEditor({ - saveText: _("ID_UPDATE"), + editor = new Ext.ux.grid.RowEditor({ + saveText: _("ID_UPDATE"), - isValid: function() - { - var valid = true; - this.items.each(function(f) { - if(!f.isValid(true)){ - valid = false; + isValid: function () + { + var valid = true; + this.items.each(function (f) { + if (!f.isValid(true)) { + valid = false; - if (valid) { - flagShowMessageError = 1; + if (valid) { + flagShowMessageError = 1; + } + return false; } + }); + + if (valid) { + flagShowMessageError = 1; + } + return valid; + }, + showTooltip: function (msg) + { + if (flagShowMessageError == 1) { + Ext.msgBoxSlider.msgTopCenter("error", _("ID_ERROR"), msg, 3); + flagShowMessageError = 0; + } + }, + + listeners: { + canceledit: function (grid, obj) { + if (grid.record.data.field_label == '' && grid.record.data.field_name == '') { + store.remove(grid.record); + } + + flagShowMessageError = 1; + } + } + }); + + editor.on({ + afteredit: function (roweditor, changes, record, rowIndex) { + }, + beforeedit: function (roweditor, rowIndex) { + row = assignedGrid.getSelectionModel().getSelected(); + if (row.get('field_name') == 'APP_UID' || row.get('field_name') == 'APP_NUMBER' || row.get('field_name') == 'ROW') { + editor.stopEditing(); return false; } - }); + setTimeout( + function () + { + var fieldTypeValue = row.get('field_type'); + var fieldIndex = Ext.getCmp("field_index"); + var fieldInc = Ext.getCmp("field_incre"); + var sizeEdit = Ext.getCmp("sizeEdit"); - if (valid) { - flagShowMessageError = 1; + editorFieldsEnableDisable(fieldTypeValue, fieldIndex, fieldInc, sizeEdit); + }, + 250 + ); } - return valid; - }, - showTooltip: function (msg) - { - if (flagShowMessageError == 1) { - Ext.msgBoxSlider.msgTopCenter("error", _("ID_ERROR"), msg, 3); - flagShowMessageError = 0; - } - }, + }); - listeners: { - canceledit: function(grid,obj){ - if ( grid.record.data.field_label == '' && grid.record.data.field_name == '') { - store.remove(grid.record); - } - - flagShowMessageError = 1; - } - } - }); - - editor.on({ - afteredit: function(roweditor, changes, record, rowIndex) { - // - }, - beforeedit: function(roweditor, rowIndex) { - row = assignedGrid.getSelectionModel().getSelected(); - if (row.get('field_name') == 'APP_UID' || row.get('field_name') == 'APP_NUMBER' || row.get('field_name') == 'ROW') { - editor.stopEditing(); - return false; - } - setTimeout( - function () + //table columns grid + assignedGrid = new Ext.grid.GridPanel({ + title: _('ID_NEW_REPORT_TABLE'), + region: 'center', + id: 'assignedGrid', + ddGroup: 'availableGridDDGroup', + enableDragDrop: true, + viewConfig: {forceFit: true}, + cm: cm, + sm: sm, + store: store, + plugins: [editor, checkColumn], + loadMask: {message: _('ID_LOADING_GRID')}, + tbar: [ { - var fieldTypeValue = row.get('field_type'); - var fieldIndex = Ext.getCmp("field_index"); - var fieldInc = Ext.getCmp("field_incre"); - var sizeEdit = Ext.getCmp("sizeEdit"); - - editorFieldsEnableDisable(fieldTypeValue, fieldIndex, fieldInc, sizeEdit); - }, - 250 - ); - } - }); - - //table columns grid - assignedGrid = new Ext.grid.GridPanel({ - title : _('ID_NEW_REPORT_TABLE'), - region : 'center', - id : 'assignedGrid', - ddGroup : 'availableGridDDGroup', - enableDragDrop : true, - viewConfig : {forceFit: true}, - cm : cm, - sm : sm, - store : store, - plugins : [editor, checkColumn], - loadMask: {message: _('ID_LOADING_GRID')}, - tbar : [ - { - id: 'assignedGridAddField', - icon: '/images/add-row-after.png', - text: _("ID_ADD_FIELD"), - handler: addColumn - }, { - id: 'removeColumn', - icon: '/images/delete-row.png', - text: _("ID_REMOVE_FIELD"), - disabled: true, - handler: removeColumn - } - ], - listeners: { - render: function(grid) { - var ddrow = new Ext.dd.DropTarget(grid.getView().mainBody, { - ddGroup: 'availableGridDDGroup', - copy: false, - notifyDrop: function(dd, e, data) { - var ds = grid.store; - var sm = grid.getSelectionModel(); - var rows = sm.getSelections(); - if (dd.getDragData(e)) { - var cindex = dd.getDragData(e).rowIndex; - //skipping primary keys, we can't reorder - if (store.data.items[cindex].data.field_key) - return; - - if (typeof(cindex) != "undefined") { - for(var i = 0; i < rows.length; i++) { - //skipping primary keys, we can't reorder - if (rows[i].data.field_key ) - continue; - - var srcIndex = ds.indexOfId(rows[i].id); - ds.remove(ds.getById(rows[i].id)); - if (i > 0 && cindex < srcIndex) { - cindex++; - } - ds.insert(cindex, rows[i]); - } - sm.selectRecords(rows); - } + id: 'assignedGridAddField', + icon: '/images/add-row-after.png', + text: _("ID_ADD_FIELD"), + handler: addColumn + }, { + id: 'removeColumn', + icon: '/images/delete-row.png', + text: _("ID_REMOVE_FIELD"), + disabled: true, + handler: removeColumn } - } - }); - } - }, - _setTitle: function() { - this.setTitle(_('ID_REPORT_TABLE') + ': ' + Ext.getCmp('REP_TAB_NAME').getValue() + ' ('+store.getCount()+' ' + _('ID_COLUMNS') + ')'); - } - }); - - // (vertical) selection buttons - buttonsPanel = new Ext.Panel({ - id: 'buttonsPanelVertical', - width : 40, - layout : { - type:'vbox', - padding:'0', - pack:'center', - align:'center' - }, - defaults:{margins:'0 0 35 0'}, - items:[ - { xtype:'button',text: '>', - handler: AssignFieldsAction, - id: 'assignButton', disabled: true - }, - { xtype:'button',text: '<', - handler: RemoveFieldsAction, - id: 'removeButton', disabled: true - }, - { xtype:'button',text: '>>', - handler: AssignAllFieldsAction, - id: 'assignButtonAll', disabled: false}, - { xtype:'button',text: '<<', - handler: RemoveAllFieldsAction, - id: 'removeButtonAll', disabled: false - } - ] - - }); - - - FieldsPanel = new Ext.Panel({ - //title: _('ID_FIELDS'), - region : 'center', - //autoWidth : true, - width: 150, - layout : 'hbox', - defaults : { flex : 1 }, //auto stretch - layoutConfig : { align : 'stretch' }, - items : [availableGrid,buttonsPanel,assignedGrid], - viewConfig : {forceFit:true} - - }); - - searchTextA = new Ext.form.TextField ({ - id: 'searchTextA', - ctCls:'pm_search_text_field', - allowBlank: true, - width: 110, - emptyText: _('ID_EMPTY_SEARCH'), + ], listeners: { - specialkey: function(f,e){ - if (e.getKey() == e.ENTER) { - DoSearchA(); - } - } - } - }); + render: function (grid) { + var ddrow = new Ext.dd.DropTarget(grid.getView().mainBody, { + ddGroup: 'availableGridDDGroup', + copy: false, + notifyDrop: function (dd, e, data) { + var ds = grid.store; + var sm = grid.getSelectionModel(); + var rows = sm.getSelections(); + if (dd.getDragData(e)) { + var cindex = dd.getDragData(e).rowIndex; + //skipping primary keys, we can't reorder + if (store.data.items[cindex].data.field_key) + return; - searchTextP = new Ext.form.TextField ({ - id: 'searchTextP', - ctCls:'pm_search_text_field', - allowBlank: true, - width: 110, - emptyText: _('ID_EMPTY_SEARCH'), - listeners: { - specialkey: function(f,e){ - if (e.getKey() == e.ENTER) { - DoSearchP(); - } - } - } - }); + if (typeof (cindex) != "undefined") { + for (var i = 0; i < rows.length; i++) { + //skipping primary keys, we can't reorder + if (rows[i].data.field_key) { + continue; + } - var types = new Ext.data.ArrayStore({ - storeId: "types", - autoDestroy: true, - - fields: ["REP_TAB_TYPE", "type"], - data : [['NORMAL',_("ID_GLOBAL")],['GRID',_("ID_GRID")]] - }); - - comboReport = new Ext.form.ComboBox({ - id : 'REP_TAB_TYPE', - name: 'type', - fieldLabel: 'Type', - hiddenName : 'REP_TAB_TYPE', - mode: 'local', - store: types, - displayField:'type', - valueField:'REP_TAB_TYPE', - width: 120, - typeAhead: true, - triggerAction: 'all', - editable:false, - lazyRender: true, - value: typeof TABLE.ADD_TAB_TYPE != 'undefined'? TABLE.ADD_TAB_TYPE : 'NORMAL', - listeners: { - select: function(combo,record,index){ - if (this.getValue()=='NORMAL') { - Ext.getCmp('REP_TAB_GRID').setVisible(false); - loadFieldNormal(); - } else { - Ext.getCmp('availableGrid').store.removeAll(); - Ext.getCmp('REP_TAB_GRID').setVisible(true); - Ext.getCmp('REP_TAB_GRID').setValue(''); - gridsListStore.reload({params:{PRO_UID : PRO_UID !== false ? PRO_UID : Ext.getCmp('PROCESS').getValue()}}); - } - } - } - }); - - - dbConnectionsStore = new Ext.data.Store({ - //autoLoad: true, - proxy : new Ext.data.HttpProxy({ - url: '../pmTablesProxy/getDbConnectionsList', - method : 'POST' - }), - baseParams : { - PRO_UID : '' - }, - reader : new Ext.data.JsonReader( { - fields : [{name : 'DBS_UID'}, {name : 'DBS_NAME'}] - }), - listeners: { - load: function() { - if (TABLE !== false) { // is editing - defaultValue = TABLE.DBS_UID; - comboDbConnections.setDisabled(true); - } - else { - defaultValue = 'workflow'; - } - - // set current editing process combobox - var i = this.findExact('DBS_UID', defaultValue, 0); - if (i > -1){ - comboDbConnections.setValue(this.getAt(i).data.DBS_UID); - comboDbConnections.setRawValue(this.getAt(i).data.DBS_NAME); - } - else { - // DB COnnection deleted - Ext.Msg.alert( _('ID_ERROR'), _('ID_DB_CONNECTION_NOT_EXIST') ); - } - } - } - }); - - comboDbConnections = new Ext.form.ComboBox({ - id: 'REP_TAB_CONNECTION', - fieldLabel : _("ID_DB_CONNECTION"), - hiddenName : 'DBS_UID', - store : dbConnectionsStore, - //value: 'rp', - valueField : 'DBS_UID', - displayField : 'DBS_NAME', - triggerAction : 'all', - editable : false, - mode:'local' - }); - - gridsListStore = new Ext.data.Store({ - //autoLoad: true, - proxy : new Ext.data.HttpProxy({ - url: '../pmTablesProxy/getDynafields', - method : 'POST' - }), - baseParams : { - PRO_UID : '', - TYPE: 'GRID' - }, - reader : new Ext.data.JsonReader( { - //root : 'processFields', - fields : [{name : 'FIELD_UID'}, {name : 'FIELD_NAME'}] - }), - listeners: { - load: function(){ - if (TABLE !== false) { - var i = this.findExact('FIELD_UID', TABLE.ADD_TAB_GRID, 0); - if (i > -1){ - comboGridsList.setValue(this.getAt(i).data.FIELD_UID); - comboGridsList.setRawValue(this.getAt(i).data.FIELD_NAME); - comboGridsList.setDisabled(true); - - var available = Ext.getCmp('availableGrid'); - available.store.load({ - params: { - action: "getDynafields", - PRO_UID: PRO_UID !== false ? PRO_UID : Ext.getCmp('PROCESS').getValue(), - TYPE: 'GRID', - GRID_UID: Ext.getCmp('REP_TAB_GRID').getValue(), - start: 0, - limit: pageSize - } - }); - } else { - Ext.Msg.alert( _('ID_ERROR'), _('ID_GRID_NO_EXIST') ); - } - } - } - } - }); - - comboGridsList = new Ext.form.ComboBox({ - id: 'REP_TAB_GRID', - fieldLabel : 'Grid', - hiddenName : 'FIELD_UID', - store : gridsListStore, - emptyText: _("ID_SELECT_GRID"), - //hidden:true, - //hideLabel: true, - //value: 'rp', - valueField : 'FIELD_UID', - displayField : 'FIELD_NAME', - triggerAction : 'all', - width: 200, - editable : false, - mode:'local', - listeners:{ - afterrender: function(){ - //Ext.getCmp('REP_TAB_GRID').setVisible(false); - //loadFieldNormal(); - }, - select: function(combo,record,index){ - - //Ext.getCmp('REP_TAB_TYPE').setVisible(true); - // Ext.getCmp('REP_TAB_GRID').setVisible(true); - loadFieldsGrids(); - - } - } - }); - - processStore = new Ext.data.Store( { - autoLoad: true, - proxy : new Ext.data.HttpProxy({ - url: '../pmTablesProxy/getProcessList', - method : 'POST' - }), - baseParams : { - action: 'getProcessList' - }, - reader : new Ext.data.JsonReader( { - fields: [{name: "PRO_UID"}, {name: "PRO_TITLE"}, {name: "PRO_DESCRIPTION"}] - }), - listeners: { - load: function() { - if (TABLE !== false) { // is editing - // set current editing process combobox - var i = this.findExact('PRO_UID', TABLE.PRO_UID, 0); - if (i > -1){ - processComboBox.setValue(this.getAt(i).data.PRO_UID); - processComboBox.setRawValue(this.getAt(i).data.PRO_TITLE); - processComboBox.setDisabled(true); - } else { - // Process deleted - Ext.Msg.alert( _('ID_ERROR'), _('ID_PROCESS_NO_EXIST') ); - } - // setting table attributes for current editing process - Ext.getCmp('REP_TAB_NAME').setValue(TABLE.ADD_TAB_NAME); - Ext.getCmp('REP_TAB_NAME').setDisabled(false); - Ext.getCmp('REP_TAB_DSC').setValue(TABLE.ADD_TAB_DESCRIPTION); - - // grid - comboReport.setDisabled(true); - if (TABLE.ADD_TAB_TYPE == 'GRID') { - Ext.getCmp('REP_TAB_GRID').setVisible(true); - gridsListStore.reload({params:{PRO_UID : Ext.getCmp('PROCESS').getValue()}}); - } - // db connections - comboDbConnections.getStore().reload({params:{PRO_UID : Ext.getCmp('PROCESS').getValue()}}); - - // loading available fields - //loadAvFieldsFromArray(avFieldsList); - //if (TABLE.ADD_TAB_TYPE == 'GRID') - //loadFieldsGrids(); - //else - if (TABLE.ADD_TAB_TYPE == 'NORMAL') - loadFieldNormal(); - - // loading table fields - loadTableRowsFromArray(TABLE.FIELDS); - } - } - } - }); - - processComboBox = new Ext.form.ComboBox({ - id: 'PROCESS', - fieldLabel : _("ID_CASESLIST_APP_PRO_TITLE"), - hiddenName : 'PRO_UID', - store : processStore, - emptyText: _("ID_EMPTY_PROCESSES"), - valueField : 'PRO_UID', - displayField : 'PRO_TITLE', - - //width: 180, - editable : true, - typeAhead: true, - mode: 'local', - autocomplete: true, - triggerAction: 'all', - forceSelection: true, - - listeners:{ - select: function(){ - var dataStoreAux = types.getRange(0); - comboReport.setValue(dataStoreAux[0].data.REP_TAB_TYPE); - comboGridsList.setVisible(false); - PRO_UID = Ext.getCmp('PROCESS').getValue().trim(); - comboDbConnections.getStore().reload({params: {PRO_UID: PRO_UID}}); - if (Ext.getCmp('REP_TAB_TYPE').getValue() == 'GRID') { - gridsListStore.reload({params: {PRO_UID: PRO_UID}}); - } else { - loadFieldNormal(); - } - } - } - }); - - var items = new Array(); - if (PRO_UID === false) - items.push(processComboBox); - - items.push({ - id: 'REP_TAB_NAME', - fieldLabel: _("ID_TABLE_NAME") + ' ('+_("ID_AUTO_PREFIX") + ' "PMT_")', - xtype:'textfield', - emptyText: _("ID_SET_A_TABLE_NAME"), - width: 250, - autoCreate: {tag: "input", type: "text", autocomplete: "off", maxlength: sizeTableName }, - stripCharsRe: /(\W+)/g, - listeners:{ - change: function(){ - this.setValue(this.getValue().toUpperCase()); - assignedGrid._setTitle(); - } - } - }); - items.push({ - id: 'REP_TAB_DSC', - fieldLabel: _("ID_DESCRIPTION"), - xtype:'textarea', - emptyText: _("ID_SET_TABLE_DESCRIPTION"), - width: 250, - height: 40, - allowBlank: true - }); - items.push({ - xtype: 'hidden', - name: 'REP_TAB_GRID', - value: 'GridComments-463650787492db06640c904001904930' - }); - items.push({ - xtype: 'compositefield', - fieldLabel: _("ID_TYPE"), - msgTarget : 'side', - anchor : '-20', - defaults : {flex: 1 }, - items: [comboReport, comboGridsList] - }); - items.push(comboDbConnections); - - - var frmDetailsConfig = { - id:'frmDetails', - region: 'north', - labelWidth: 180, - labelAlign:'right', - title: ADD_TAB_UID ? _('ID_REPORT_TABLE') : _('ID_NEW_REPORT_TABLE'), - bodyStyle:'padding:10px', - waitMsgTarget : true, - frame: true, - defaults: { - allowBlank: false, - msgTarget: 'side', - align:'center' - }, - listeners: { - afterRender: function () { - this.setHeight('auto'); - } - }, - items: items - }; - - var frmDetails = new Ext.FormPanel(frmDetailsConfig); - - southPanel = new Ext.FormPanel({ - region: 'south', - buttons:[ { - id: 'southPanelCreateUpdate', - text: TABLE === false ? _("ID_CREATE") : _("ID_UPDATE"), - handler: function() - { - if (TABLE === false) { - createReportTable(); - } else { - var oldRepTabName = TABLE.ADD_TAB_NAME; - var newRepTabName = Ext.getCmp("REP_TAB_NAME").getValue().trim(); - - if (newRepTabName != "") { - if (oldRepTabName != newRepTabName) { - Ext.MessageBox.show({ - title: _("ID_CONFIRM"), - msg: _("ID_RT_RENAME_NAME_TABLE"), - icon: Ext.MessageBox.QUESTION, - buttons: { - yes: _("ID_RT_CONTINUE_TABLE_RENAME"), - no: _("ID_RT_NOT_CHANGE_NAME") - }, - fn: function (buttonId, text, opt) - { - if (buttonId == "yes") { - createReportTable(); + var srcIndex = ds.indexOfId(rows[i].id); + ds.remove(ds.getById(rows[i].id)); + if (i > 0 && cindex < srcIndex) { + cindex++; + } + ds.insert(cindex, rows[i]); } + sm.selectRecords(rows); + } + } + } + }); + } + }, + _setTitle: function () { + this.setTitle(_('ID_REPORT_TABLE') + ': ' + Ext.getCmp('REP_TAB_NAME').getValue() + ' (' + store.getCount() + ' ' + _('ID_COLUMNS') + ')'); + } + }); + + // (vertical) selection buttons + buttonsPanel = new Ext.Panel({ + id: 'buttonsPanelVertical', + width: 40, + layout: { + type: 'vbox', + padding: '0', + pack: 'center', + align: 'center' + }, + defaults: {margins: '0 0 35 0'}, + items: [ + {xtype: 'button', text: '>', + handler: AssignFieldsAction, + id: 'assignButton', disabled: true + }, + {xtype: 'button', text: '<', + handler: RemoveFieldsAction, + id: 'removeButton', disabled: true + }, + {xtype: 'button', text: '>>', + handler: AssignAllFieldsAction, + id: 'assignButtonAll', disabled: false}, + {xtype: 'button', text: '<<', + handler: RemoveAllFieldsAction, + id: 'removeButtonAll', disabled: false + } + ] + + }); + + + FieldsPanel = new Ext.Panel({ + region: 'center', + width: 150, + layout: 'hbox', + defaults: {flex: 1}, //auto stretch + layoutConfig: {align: 'stretch'}, + items: [availableGrid, buttonsPanel, assignedGrid], + viewConfig: {forceFit: true} + + }); + + searchTextA = new Ext.form.TextField({ + id: 'searchTextA', + ctCls: 'pm_search_text_field', + allowBlank: true, + width: 110, + emptyText: _('ID_EMPTY_SEARCH'), + listeners: { + specialkey: function (f, e) { + if (e.getKey() == e.ENTER) { + DoSearchA(); + } + } + } + }); + + searchTextP = new Ext.form.TextField({ + id: 'searchTextP', + ctCls: 'pm_search_text_field', + allowBlank: true, + width: 110, + emptyText: _('ID_EMPTY_SEARCH'), + listeners: { + specialkey: function (f, e) { + if (e.getKey() == e.ENTER) { + DoSearchP(); + } + } + } + }); + + var types = new Ext.data.ArrayStore({ + storeId: "types", + autoDestroy: true, + + fields: ["REP_TAB_TYPE", "type"], + data: [['NORMAL', _("ID_GLOBAL")], ['GRID', _("ID_GRID")]] + }); + + comboReport = new Ext.form.ComboBox({ + id: 'REP_TAB_TYPE', + name: 'type', + fieldLabel: 'Type', + hiddenName: 'REP_TAB_TYPE', + mode: 'local', + store: types, + displayField: 'type', + valueField: 'REP_TAB_TYPE', + width: 120, + typeAhead: true, + triggerAction: 'all', + editable: false, + lazyRender: true, + value: typeof TABLE.ADD_TAB_TYPE != 'undefined' ? TABLE.ADD_TAB_TYPE : 'NORMAL', + listeners: { + select: function (combo, record, index) { + if (this.getValue() == 'NORMAL') { + Ext.getCmp('REP_TAB_GRID').setVisible(false); + loadFieldNormal(); + } else { + Ext.getCmp('availableGrid').store.removeAll(); + Ext.getCmp('REP_TAB_GRID').setVisible(true); + Ext.getCmp('REP_TAB_GRID').setValue(''); + gridsListStore.reload({params: {PRO_UID: PRO_UID !== false ? PRO_UID : Ext.getCmp('PROCESS').getValue()}}); + } + } + } + }); + + + dbConnectionsStore = new Ext.data.Store({ + proxy: new Ext.data.HttpProxy({ + url: '../pmTablesProxy/getDbConnectionsList', + method: 'POST' + }), + baseParams: { + PRO_UID: '' + }, + reader: new Ext.data.JsonReader({ + fields: [{name: 'DBS_UID'}, {name: 'DBS_NAME'}] + }), + listeners: { + load: function () { + if (TABLE !== false) { // is editing + defaultValue = TABLE.DBS_UID; + comboDbConnections.setDisabled(true); + } else { + defaultValue = 'workflow'; + } + + // set current editing process combobox + var i = this.findExact('DBS_UID', defaultValue, 0); + if (i > -1) { + comboDbConnections.setValue(this.getAt(i).data.DBS_UID); + comboDbConnections.setRawValue(this.getAt(i).data.DBS_NAME); + } else { + // DB COnnection deleted + Ext.Msg.alert(_('ID_ERROR'), _('ID_DB_CONNECTION_NOT_EXIST')); + } + } + } + }); + + comboDbConnections = new Ext.form.ComboBox({ + id: 'REP_TAB_CONNECTION', + fieldLabel: _("ID_DB_CONNECTION"), + hiddenName: 'DBS_UID', + store: dbConnectionsStore, + valueField: 'DBS_UID', + displayField: 'DBS_NAME', + triggerAction: 'all', + editable: false, + mode: 'local' + }); + + gridsListStore = new Ext.data.Store({ + proxy: new Ext.data.HttpProxy({ + url: '../pmTablesProxy/getDynafields', + method: 'POST' + }), + baseParams: { + PRO_UID: '', + TYPE: 'GRID' + }, + reader: new Ext.data.JsonReader({ + fields: [{name: 'FIELD_UID'}, {name: 'FIELD_NAME'}] + }), + listeners: { + load: function () { + if (TABLE !== false) { + var i = this.findExact('FIELD_UID', TABLE.ADD_TAB_GRID, 0); + if (i > -1) { + comboGridsList.setValue(this.getAt(i).data.FIELD_UID); + comboGridsList.setRawValue(this.getAt(i).data.FIELD_NAME); + comboGridsList.setDisabled(true); + + var available = Ext.getCmp('availableGrid'); + available.store.load({ + params: { + action: "getDynafields", + PRO_UID: PRO_UID !== false ? PRO_UID : Ext.getCmp('PROCESS').getValue(), + TYPE: 'GRID', + GRID_UID: Ext.getCmp('REP_TAB_GRID').getValue(), + start: 0, + limit: pageSize } }); } else { - createReportTable(); + Ext.Msg.alert(_('ID_ERROR'), _('ID_GRID_NO_EXIST')); } - } else { - PMExt.error( - _("ID_ERROR"), - _("ID_TABLE_NAME_IS_REQUIRED"), - function() - { - Ext.getCmp("REP_TAB_NAME").focus(); - } - ); } } } - }, { - id: 'southPanelCancel', - text:_("ID_CANCEL"), - handler: function() { - proParam = (typeof('flagProcessmap') != 'undefined' && flagProcessmap == 1) ? (PRO_UID !== false ? '?flagProcessmap=1&PRO_UID='+PRO_UID : '') : ''; - location.href = '../pmTables' + proParam; //history.back(); + }); + + comboGridsList = new Ext.form.ComboBox({ + id: 'REP_TAB_GRID', + fieldLabel: 'Grid', + hiddenName: 'FIELD_UID', + store: gridsListStore, + emptyText: _("ID_SELECT_GRID"), + valueField: 'FIELD_UID', + displayField: 'FIELD_NAME', + triggerAction: 'all', + width: 200, + editable: false, + mode: 'local', + listeners: { + afterrender: function () { + }, + select: function (combo, record, index) { + loadFieldsGrids(); + + } } - }] - }); + }); - var viewport = new Ext.Viewport({ - layout: 'border', - autoScroll: false, - items:[frmDetails, FieldsPanel, southPanel] - }); + processStore = new Ext.data.Store({ + autoLoad: true, + proxy: new Ext.data.HttpProxy({ + url: '../pmTablesProxy/getProcessList', + method: 'POST' + }), + baseParams: { + action: 'getProcessList' + }, + reader: new Ext.data.JsonReader({ + fields: [{name: "PRO_UID"}, {name: "PRO_TITLE"}, {name: "PRO_DESCRIPTION"}] + }), + listeners: { + load: function () { + if (TABLE !== false) { // is editing + // set current editing process combobox + var i = this.findExact('PRO_UID', TABLE.PRO_UID, 0); + if (i > -1) { + processComboBox.setValue(this.getAt(i).data.PRO_UID); + processComboBox.setRawValue(this.getAt(i).data.PRO_TITLE); + processComboBox.setDisabled(true); + } else { + // Process deleted + Ext.Msg.alert(_('ID_ERROR'), _('ID_PROCESS_NO_EXIST')); + } + // setting table attributes for current editing process + Ext.getCmp('REP_TAB_NAME').setValue(TABLE.ADD_TAB_NAME); + Ext.getCmp('REP_TAB_NAME').setDisabled(false); + Ext.getCmp('REP_TAB_DSC').setValue(TABLE.ADD_TAB_DESCRIPTION); - /*** Editing routines ***/ - if (TABLE !== false) { - if(TABLE.ADD_TAB_TYPE != 'GRID') - Ext.getCmp('REP_TAB_GRID').hide(); - } else { - Ext.getCmp('REP_TAB_GRID').hide(); - } + // grid + comboReport.setDisabled(true); + if (TABLE.ADD_TAB_TYPE == 'GRID') { + Ext.getCmp('REP_TAB_GRID').setVisible(true); + gridsListStore.reload({params: {PRO_UID: Ext.getCmp('PROCESS').getValue()}}); + } + // db connections + comboDbConnections.getStore().reload({params: {PRO_UID: Ext.getCmp('PROCESS').getValue()}}); - if (PRO_UID !== false) { - comboDbConnections.getStore().reload({params:{PRO_UID : PRO_UID}}); - if (Ext.getCmp('REP_TAB_TYPE').getValue() == 'GRID') { - gridsListStore.reload({params:{PRO_UID : PRO_UID}}); + // loading available fields + if (TABLE.ADD_TAB_TYPE == 'NORMAL') + loadFieldNormal(); + + // loading table fields + loadTableRowsFromArray(TABLE.FIELDS); + } + } + } + }); + + processComboBox = new Ext.form.ComboBox({ + id: 'PROCESS', + fieldLabel: _("ID_CASESLIST_APP_PRO_TITLE"), + hiddenName: 'PRO_UID', + store: processStore, + emptyText: _("ID_EMPTY_PROCESSES"), + valueField: 'PRO_UID', + displayField: 'PRO_TITLE', + editable: true, + typeAhead: true, + mode: 'local', + autocomplete: true, + triggerAction: 'all', + forceSelection: true, + + listeners: { + select: function () { + var dataStoreAux = types.getRange(0); + comboReport.setValue(dataStoreAux[0].data.REP_TAB_TYPE); + comboGridsList.setVisible(false); + PRO_UID = Ext.getCmp('PROCESS').getValue().trim(); + comboDbConnections.getStore().reload({params: {PRO_UID: PRO_UID}}); + if (Ext.getCmp('REP_TAB_TYPE').getValue() == 'GRID') { + gridsListStore.reload({params: {PRO_UID: PRO_UID}}); + } else { + loadFieldNormal(); + } + } + } + }); + + var items = new Array(); + if (PRO_UID === false) { + items.push(processComboBox); } - if (TABLE === false) { - if(TABLE.ADD_TAB_TYPE != 'GRID') - loadFieldNormal(); - } - } + items.push({ + id: 'REP_TAB_NAME', + fieldLabel: _("ID_TABLE_NAME") + ' (' + _("ID_AUTO_PREFIX") + ' "PMT_")', + xtype: 'textfield', + emptyText: _("ID_SET_A_TABLE_NAME"), + width: 250, + autoCreate: {tag: "input", type: "text", autocomplete: "off", maxlength: sizeTableName}, + stripCharsRe: /(\W+)/g, + listeners: { + change: function () { + this.setValue(this.getValue().toUpperCase()); + assignedGrid._setTitle(); + } + } + }); + items.push({ + id: 'REP_TAB_DSC', + fieldLabel: _("ID_DESCRIPTION"), + xtype: 'textarea', + emptyText: _("ID_SET_TABLE_DESCRIPTION"), + width: 250, + height: 40, + allowBlank: true + }); + items.push({ + xtype: 'hidden', + name: 'REP_TAB_GRID', + value: 'GridComments-463650787492db06640c904001904930' + }); + items.push({ + xtype: 'compositefield', + fieldLabel: _("ID_TYPE"), + msgTarget: 'side', + anchor: '-20', + defaults: {flex: 1}, + items: [comboReport, comboGridsList] + }); + items.push(comboDbConnections); - DDLoadFields(); + + var frmDetailsConfig = { + id: 'frmDetails', + region: 'north', + labelWidth: 180, + labelAlign: 'right', + title: ADD_TAB_UID ? _('ID_REPORT_TABLE') : _('ID_NEW_REPORT_TABLE'), + bodyStyle: 'padding:10px', + waitMsgTarget: true, + frame: true, + defaults: { + allowBlank: false, + msgTarget: 'side', + align: 'center' + }, + listeners: { + afterRender: function () { + this.setHeight('auto'); + } + }, + items: items + }; + + var frmDetails = new Ext.FormPanel(frmDetailsConfig); + + southPanel = new Ext.FormPanel({ + region: 'south', + buttons: [{ + id: 'southPanelCreateUpdate', + text: TABLE === false ? _("ID_CREATE") : _("ID_UPDATE"), + handler: function () + { + if (TABLE === false) { + createReportTable(); + } else { + var oldRepTabName = TABLE.ADD_TAB_NAME; + var newRepTabName = Ext.getCmp("REP_TAB_NAME").getValue().trim(); + + if (newRepTabName != "") { + if (oldRepTabName != newRepTabName) { + Ext.MessageBox.show({ + title: _("ID_CONFIRM"), + msg: _("ID_RT_RENAME_NAME_TABLE"), + icon: Ext.MessageBox.QUESTION, + buttons: { + yes: _("ID_RT_CONTINUE_TABLE_RENAME"), + no: _("ID_RT_NOT_CHANGE_NAME") + }, + fn: function (buttonId, text, opt) + { + if (buttonId == "yes") { + createReportTable(); + } + } + }); + } else { + createReportTable(); + } + } else { + PMExt.error( + _("ID_ERROR"), + _("ID_TABLE_NAME_IS_REQUIRED"), + function () + { + Ext.getCmp("REP_TAB_NAME").focus(); + } + ); + } + } + } + }, { + id: 'southPanelCancel', + text: _("ID_CANCEL"), + handler: function () { + proParam = (typeof ('flagProcessmap') != 'undefined' && flagProcessmap == 1) ? (PRO_UID !== false ? '?flagProcessmap=1&PRO_UID=' + PRO_UID : '') : ''; + location.href = '../pmTables' + proParam; + } + }] + }); + + var viewport = new Ext.Viewport({ + layout: 'border', + autoScroll: false, + items: [frmDetails, FieldsPanel, southPanel] + }); + + /*** Editing routines ***/ + if (TABLE !== false) { + if (TABLE.ADD_TAB_TYPE != 'GRID') { + Ext.getCmp('REP_TAB_GRID').hide(); + } + } else { + Ext.getCmp('REP_TAB_GRID').hide(); + } + + if (PRO_UID !== false) { + comboDbConnections.getStore().reload({params: {PRO_UID: PRO_UID}}); + if (Ext.getCmp('REP_TAB_TYPE').getValue() == 'GRID') { + gridsListStore.reload({params: {PRO_UID: PRO_UID}}); + } + + if (TABLE === false) { + if (TABLE.ADD_TAB_TYPE != 'GRID') { + loadFieldNormal(); + } + } + } + + DDLoadFields(); }); - - - - -////////////////////////////////////////////////////////////////////////////////////////// - function createReportTable() { - var tableName = Ext.getCmp('REP_TAB_NAME').getValue().trim(); - var tableDescription = Ext.getCmp('REP_TAB_DSC').getValue().trim(); + var tableName = Ext.getCmp('REP_TAB_NAME').getValue().trim(); + var tableDescription = Ext.getCmp('REP_TAB_DSC').getValue().trim(); - //validate table name - if(Ext.getCmp('REP_TAB_NAME').getValue().trim() == '') { - Ext.getCmp('REP_TAB_NAME').focus(); - PMExt.error(_('ID_ERROR'), _('ID_TABLE_NAME_IS_REQUIRED'), function(){ - Ext.getCmp('REP_TAB_NAME').focus(); - }); - return false; - } + //validate table name + if (Ext.getCmp('REP_TAB_NAME').getValue().trim() == '') { + Ext.getCmp('REP_TAB_NAME').focus(); + PMExt.error(_('ID_ERROR'), _('ID_TABLE_NAME_IS_REQUIRED'), function () { + Ext.getCmp('REP_TAB_NAME').focus(); + }); + return false; + } //validate process PRO_UID = (PRO_UID !== false && PRO_UID !== "") ? PRO_UID : ((Ext.getCmp('PROCESS').getValue().trim() != '') ? Ext.getCmp('PROCESS').getValue().trim() : ''); - if(PRO_UID == '') { + if (PRO_UID == '') { Ext.getCmp('PROCESS').focus(); - PMExt.error(_('ID_ERROR'), _('ID_PROCESS_IS_REQUIRED'), function(){ + PMExt.error(_('ID_ERROR'), _('ID_PROCESS_IS_REQUIRED'), function () { Ext.getCmp('PROCESS').focus(); }); return false; } - // validate table name length - if(tableName.length < 4) { - PMExt.error(_('ID_ERROR'), _('ID_TABLE_NAME_TOO_SHORT'), function(){ - Ext.getCmp('REP_TAB_NAME').focus(); - }); - return false; - } - - var allRows = assignedGrid.getStore(); - var columns = new Array(); - - var hasSomePrimaryKey = false; - - //validate columns count - if(allRows.getCount() == 0) { - PMExt.error(_('ID_ERROR'), _('ID_PMTABLES_ALERT7')); - return false; - } - var fieldsNames = new Array(); - // Reserved Words - var reservedWords = new Array('DESC'); - - for (var r=0; r < allRows.getCount(); r++) { - row = allRows.getAt(r); - - if (in_array(row.data['field_name'], fieldsNames)) { - PMExt.error(_('ID_ERROR'),_('ID_PMTABLES_ALERT1') + ' ' + row.data['field_name']+''); - return false; - } - - for (j=0; j < reservedWords.length; j++) { - if (row.data['field_name'] == reservedWords[j]) { - PMExt.error(_('ID_ERROR'), _('ID_PMTABLES_RESERVED_FIELDNAME_WARNING', reservedWords[j])); + // validate table name length + if (tableName.length < 4) { + PMExt.error(_('ID_ERROR'), _('ID_TABLE_NAME_TOO_SHORT'), function () { + Ext.getCmp('REP_TAB_NAME').focus(); + }); return false; - } } - // validate that fieldname is not empty - if(row.data['field_name'].trim() == '') { - PMExt.error(_('ID_ERROR'), _('ID_PMTABLES_ALERT2')); - return false; + var allRows = assignedGrid.getStore(); + var columns = new Array(); + + var hasSomePrimaryKey = false; + + //validate columns count + if (allRows.getCount() == 0) { + PMExt.error(_('ID_ERROR'), _('ID_PMTABLES_ALERT7')); + return false; } + var fieldsNames = new Array(); + // Reserved Words + var reservedWords = new Array('DESC'); - if(row.data['field_label'].trim() == '') { - PMExt.error(_('ID_ERROR'), _('ID_PMTABLES_ALERT3')); - return false; - } + for (var r = 0; r < allRows.getCount(); r++) { + row = allRows.getAt(r); - // validate field size for varchar & int column types - if ((row.data['field_type'] == 'VARCHAR' || row.data['field_type'] == 'INTEGER') && row.data['field_size'] == '') { - PMExt.error(_('ID_ERROR'), _('ID_PMTABLES_ALERT5')+' '+row.data['field_name']+' ('+row.data['field_type']+').'); - return false; - } - - if (row.data['field_index']) { - hasSomeIndex = true; - } else { - hasSomeIndex = false; - } - - if (row.data['field_key']) { - hasSomePrimaryKey = true; - } - - columns.push(row.data); - } - - Ext.Msg.show({ - title : '', - msg : TABLE !== false ? _('ID_UPDATING_TABLE') : _('ID_CREATING_TABLE'), - wait:true, - waitConfig: {interval:500} - }); - - Ext.Ajax.request({ - url: '../pmTablesProxy/save', - params: { - REP_TAB_UID : TABLE !== false ? TABLE.ADD_TAB_UID : '', - PRO_UID : PRO_UID !== false? PRO_UID : Ext.getCmp('PROCESS').getValue(), - REP_TAB_NAME : TABLE !== false ? tableName : 'PMT_' + tableName, - REP_TAB_DSC : tableDescription, - REP_TAB_CONNECTION : Ext.getCmp('REP_TAB_CONNECTION').getValue(), - REP_TAB_TYPE : Ext.getCmp('REP_TAB_TYPE').getValue(), - REP_TAB_GRID : Ext.getCmp('REP_TAB_TYPE').getValue()=='GRID'? Ext.getCmp('REP_TAB_GRID').getValue(): '', - columns : Ext.util.JSON.encode(columns) - }, - success: function(resp){ - result = Ext.util.JSON.decode(resp.responseText); - Ext.MessageBox.hide(); - - if (result.success) { - proParam = (typeof('flagProcessmap') != 'undefined' && flagProcessmap == 1) ? (PRO_UID !== false ? '?flagProcessmap=1&PRO_UID='+PRO_UID : '') : ''; - location.href = '../pmTables' + proParam; //history.back(); - } else { - PMExt.error(_('ID_ERROR'), result.type +': '+result.msg); - if (window.console && window.console.firebug) { - window.console.log(result.msg); - window.console.log(result.trace); + if (in_array(row.data['field_name'], fieldsNames)) { + PMExt.error(_('ID_ERROR'), _('ID_PMTABLES_ALERT1') + ' ' + row.data['field_name'] + ''); + return false; } - } - }, - failure: function(obj, resp){ - Ext.Msg.alert( _('ID_ERROR'), resp.result.msg); + + for (j = 0; j < reservedWords.length; j++) { + if (row.data['field_name'] == reservedWords[j]) { + PMExt.error(_('ID_ERROR'), _('ID_PMTABLES_RESERVED_FIELDNAME_WARNING', reservedWords[j])); + return false; + } + } + + // validate that fieldname is not empty + if (row.data['field_name'].trim() == '') { + PMExt.error(_('ID_ERROR'), _('ID_PMTABLES_ALERT2')); + return false; + } + + if (row.data['field_label'].trim() == '') { + PMExt.error(_('ID_ERROR'), _('ID_PMTABLES_ALERT3')); + return false; + } + + // validate field size for varchar & int column types + if ((row.data['field_type'] == 'VARCHAR' || row.data['field_type'] == 'INTEGER') && row.data['field_size'] == '') { + PMExt.error(_('ID_ERROR'), _('ID_PMTABLES_ALERT5') + ' ' + row.data['field_name'] + ' (' + row.data['field_type'] + ').'); + return false; + } + + if (row.data['field_index']) { + hasSomeIndex = true; + } else { + hasSomeIndex = false; + } + + if (row.data['field_key']) { + hasSomePrimaryKey = true; + } + + columns.push(row.data); } - }); + + Ext.Msg.show({ + title: '', + msg: TABLE !== false ? _('ID_UPDATING_TABLE') : _('ID_CREATING_TABLE'), + wait: true, + waitConfig: {interval: 500} + }); + + Ext.Ajax.request({ + url: '../pmTablesProxy/save', + params: { + REP_TAB_UID: TABLE !== false ? TABLE.ADD_TAB_UID : '', + PRO_UID: PRO_UID !== false ? PRO_UID : Ext.getCmp('PROCESS').getValue(), + REP_TAB_NAME: TABLE !== false ? tableName : 'PMT_' + tableName, + REP_TAB_DSC: tableDescription, + REP_TAB_CONNECTION: Ext.getCmp('REP_TAB_CONNECTION').getValue(), + REP_TAB_TYPE: Ext.getCmp('REP_TAB_TYPE').getValue(), + REP_TAB_GRID: Ext.getCmp('REP_TAB_TYPE').getValue() == 'GRID' ? Ext.getCmp('REP_TAB_GRID').getValue() : '', + columns: Ext.util.JSON.encode(columns) + }, + success: function (resp) { + result = Ext.util.JSON.decode(resp.responseText); + Ext.MessageBox.hide(); + + if (result.success) { + proParam = (typeof ('flagProcessmap') != 'undefined' && flagProcessmap == 1) ? (PRO_UID !== false ? '?flagProcessmap=1&PRO_UID=' + PRO_UID : '') : ''; + location.href = '../pmTables' + proParam; + } else { + PMExt.error(_('ID_ERROR'), result.type + ': ' + result.msg); + if (window.console && window.console.firebug) { + window.console.log(result.msg); + window.console.log(result.trace); + } + } + }, + failure: function (obj, resp) { + Ext.Msg.alert(_('ID_ERROR'), resp.result.msg); + } + }); } //end createReportTable //add custon column for assignedGrid function addColumn() { - if (!verifyTableLimit()) { - return false; - } + if (!verifyTableLimit()) { + return false; + } - var PMRow = assignedGrid.getStore().recordType; - var row = new PMRow({ - uid : '', - field_uid : '', - field_dyn : '', - field_name : '', - field_label : '', - field_type : '', - field_size : '', - field_key : 0, - field_index : 0, - field_null : 1 - }); - var len = assignedGrid.getStore().data.length; + var PMRow = assignedGrid.getStore().recordType; + var row = new PMRow({ + uid: '', + field_uid: '', + field_dyn: '', + field_name: '', + field_label: '', + field_type: '', + field_size: '', + field_key: 0, + field_index: 0, + field_null: 1 + }); + var len = assignedGrid.getStore().data.length; - editor.stopEditing(); - store.insert(len, row); - assignedGrid.getView().refresh(); - assignedGrid.getSelectionModel().selectRow(len); - editor.startEditing(len); + editor.stopEditing(); + store.insert(len, row); + assignedGrid.getView().refresh(); + assignedGrid.getSelectionModel().selectRow(len); + editor.startEditing(len); } function removeColumn() { - PMExt.confirm(_('ID_CONFIRM'), _('ID_CONFIRM_REMOVE_FIELD'), function(){ - var records = Ext.getCmp('assignedGrid').getSelectionModel().getSelections(); - Ext.each(records, Ext.getCmp('assignedGrid').store.remove, Ext.getCmp('assignedGrid').store); - }); + PMExt.confirm(_('ID_CONFIRM'), _('ID_CONFIRM_REMOVE_FIELD'), function () { + var records = Ext.getCmp('assignedGrid').getSelectionModel().getSelections(); + Ext.each(records, Ext.getCmp('assignedGrid').store.remove, Ext.getCmp('assignedGrid').store); + }); } function editorFieldsEnableDisable(fieldTypeValue, fieldIndex, fieldInc, sizeEdit) @@ -1329,11 +1297,11 @@ function editorFieldsEnableDisable(fieldTypeValue, fieldIndex, fieldInc, sizeEdi //Numbers if (fieldTypeValue == "INTEGER" || fieldTypeValue == "BIGINT") { - //Enable All + //Enable All } if (fieldTypeValue == "TINYINT" || fieldTypeValue == "SMALLINT") { - swSize = 0; + swSize = 0; } if (fieldTypeValue == "DECIMAL" || fieldTypeValue == "FLOAT") { @@ -1343,10 +1311,10 @@ function editorFieldsEnableDisable(fieldTypeValue, fieldIndex, fieldInc, sizeEdi } if (fieldTypeValue == "DOUBLE" || fieldTypeValue == "REAL") { - swSize = 0; - swPK = 0; - swAI = 0; - swI = 0; + swSize = 0; + swPK = 0; + swAI = 0; + swI = 0; } //String @@ -1368,14 +1336,14 @@ function editorFieldsEnableDisable(fieldTypeValue, fieldIndex, fieldInc, sizeEdi swAI = 0; swI = 0; } -/*----------------------------------********---------------------------------*/ + /*----------------------------------********---------------------------------*/ if (swI == 1) { fieldIndex.enable(); } else { fieldIndex.disable(); fieldIndex.setValue(false); } -/*----------------------------------********---------------------------------*/ + /*----------------------------------********---------------------------------*/ if (swAI == 1) { fieldInc.enable(); } else { @@ -1398,382 +1366,380 @@ function editorFieldsEnableDisable(fieldTypeValue, fieldIndex, fieldInc, sizeEdi sizeEdit.setValue(""); } } -////ASSIGNBUTON FUNCTIONALITY -AssignFieldsAction = function(){ - records = Ext.getCmp('availableGrid').getSelectionModel().getSelections(); - setReportFields(records); +//ASSIGNBUTON FUNCTIONALITY +AssignFieldsAction = function () { + records = Ext.getCmp('availableGrid').getSelectionModel().getSelections(); + setReportFields(records); }; //RemoveButton Functionality -RemoveFieldsAction = function(){ - records = Ext.getCmp('assignedGrid').getSelectionModel().getSelections(); - //remove from source grid - unsetReportFields(records); +RemoveFieldsAction = function () { + records = Ext.getCmp('assignedGrid').getSelectionModel().getSelections(); + //remove from source grid + unsetReportFields(records); }; //AssignALLButton Functionality -AssignAllFieldsAction = function(){ - var avStore = Ext.getCmp('availableGrid').getStore(); - var records = new Array(); +AssignAllFieldsAction = function () { + var avStore = Ext.getCmp('availableGrid').getStore(); + var records = new Array(); - if (avStore.getCount() > 0){ - for (i=0; i < avStore.getCount(); i++){ - records[i] = avStore.getAt(i); + if (avStore.getCount() > 0) { + for (i = 0; i < avStore.getCount(); i++) { + records[i] = avStore.getAt(i); + } + setReportFields(records); } - setReportFields(records); - } }; //RevomeALLButton Functionality -RemoveAllFieldsAction = function(){ +RemoveAllFieldsAction = function () { - if (store.getCount() > 100) { - PMExt.info(_('ID_NOTICE'), _('ID_ACTION_DISABLED_TO_LOW_PERFORMANCE_1') + _('ID_ACTION_DISABLED_TO_LOW_PERFORMANCE_2') ); - return ; - } - - var allRows = Ext.getCmp('assignedGrid').getStore(); - var records = new Array(); - if (allRows.getCount() > 0) { - for (var i=0; i < allRows.getCount(); i++){ - records[i] = allRows.getAt(i); + if (store.getCount() > 100) { + PMExt.info(_('ID_NOTICE'), _('ID_ACTION_DISABLED_TO_LOW_PERFORMANCE_1') + _('ID_ACTION_DISABLED_TO_LOW_PERFORMANCE_2')); + return; + } + + var allRows = Ext.getCmp('assignedGrid').getStore(); + var records = new Array(); + if (allRows.getCount() > 0) { + for (var i = 0; i < allRows.getCount(); i++) { + records[i] = allRows.getAt(i); + } + //remove from source grid + unsetReportFields(records); } - //remove from source grid - unsetReportFields(records); - } }; //INITIAL FIELDS GRIDS -loadFieldNormal = function(){ - Ext.getCmp('availableGrid').store.removeAll(); - Ext.getCmp('availableGrid').store.load({ - params: { - action: "getDynafields", - PRO_UID: PRO_UID !== false ? PRO_UID : Ext.getCmp('PROCESS').getValue(), - start: 0, - limit: pageSize, - loadField: 1 +loadFieldNormal = function () { + Ext.getCmp('availableGrid').store.removeAll(); + Ext.getCmp('availableGrid').store.load({ + params: { + action: "getDynafields", + PRO_UID: PRO_UID !== false ? PRO_UID : Ext.getCmp('PROCESS').getValue(), + start: 0, + limit: pageSize, + loadField: 1 + } + }); + var assignedGridGotData = Ext.getCmp('assignedGrid').getStore().getCount() > 0; + if (assignedGridGotData) { + Ext.MessageBox.confirm(_('ID_CONFIRM'), _('ID_CONFIRM_ASSIGNED_GRID'), function (button) { + if (button == 'yes') { + Ext.getCmp('assignedGrid').store.removeAll(); + } + }); } - }); - var assignedGridGotData = Ext.getCmp('assignedGrid').getStore().getCount() > 0; - if(assignedGridGotData) { - Ext.MessageBox.confirm(_('ID_CONFIRM'), _('ID_CONFIRM_ASSIGNED_GRID'), function(button) { - if(button=='yes'){ - Ext.getCmp('assignedGrid').store.removeAll(); - } - }); - } }; -loadFieldsGrids = function(){ - var available = Ext.getCmp('availableGrid'); - available.store.removeAll(); +loadFieldsGrids = function () { + var available = Ext.getCmp('availableGrid'); + available.store.removeAll(); - available.store.load({ - params: { - action: "getDynafields", - PRO_UID: PRO_UID !== false ? PRO_UID : Ext.getCmp('PROCESS').getValue(), - TYPE: 'GRID', - GRID_UID: Ext.getCmp('REP_TAB_GRID').getValue(), - start: 0, - limit: pageSize, - loadField: 1 - } - }); + available.store.load({ + params: { + action: "getDynafields", + PRO_UID: PRO_UID !== false ? PRO_UID : Ext.getCmp('PROCESS').getValue(), + TYPE: 'GRID', + GRID_UID: Ext.getCmp('REP_TAB_GRID').getValue(), + start: 0, + limit: pageSize, + loadField: 1 + } + }); - var assigned = Ext.getCmp('assignedGrid'); - assigned.store.removeAll(); + var assigned = Ext.getCmp('assignedGrid'); + assigned.store.removeAll(); }; //REFRESH FIELDS GRIDS -RefreshFields = function(){ - var available = Ext.getCmp('availableGrid'); - available.store.load({params: {"action":"deleteFieldsReportTables", "PRO_UID":PRO_UID }}); - var assigned = Ext.getCmp('assignedGrid'); - assigned.store.load({params: {"action":"assignedFieldsReportTables", "PRO_UID":PRO_UID }}); +RefreshFields = function () { + var available = Ext.getCmp('availableGrid'); + available.store.load({params: {"action": "deleteFieldsReportTables", "PRO_UID": PRO_UID}}); + var assigned = Ext.getCmp('assignedGrid'); + assigned.store.load({params: {"action": "assignedFieldsReportTables", "PRO_UID": PRO_UID}}); }; //FAILURE AJAX FUNCTION -FailureFields = function(){ - Ext.Msg.alert(_('ID_GROUPS'), _('ID_MSG_AJAX_FAILURE')); +FailureFields = function () { + Ext.Msg.alert(_('ID_GROUPS'), _('ID_MSG_AJAX_FAILURE')); }; // drag & drop handler -var DDLoadFields = function(){ - var availableGridDropTargetEl = availableGrid.getView().scroller.dom; - var availableGridDropTarget = new Ext.dd.DropTarget(availableGridDropTargetEl, { - ddGroup : 'availableGridDDGroup', - notifyDrop : function(ddSource, e, data){ - var records = ddSource.dragData.selections; - unsetReportFields(records); - return true; - } - }); +var DDLoadFields = function () { + var availableGridDropTargetEl = availableGrid.getView().scroller.dom; + var availableGridDropTarget = new Ext.dd.DropTarget(availableGridDropTargetEl, { + ddGroup: 'availableGridDDGroup', + notifyDrop: function (ddSource, e, data) { + var records = ddSource.dragData.selections; + unsetReportFields(records); + return true; + } + }); - //droptarget on grid forassignment - var assignedGridDropTargetEl = assignedGrid.getView().scroller.dom; - var assignedGridDropTarget = new Ext.dd.DropTarget(assignedGridDropTargetEl, { - ddGroup : 'assignedGridDDGroup', - notifyDrop : function(ddSource, e, data){ - //add on target grid - setReportFields(ddSource.dragData.selections) - return true; - } - }); - //sw_func_groups = true; + //droptarget on grid forassignment + var assignedGridDropTargetEl = assignedGrid.getView().scroller.dom; + var assignedGridDropTarget = new Ext.dd.DropTarget(assignedGridDropTargetEl, { + ddGroup: 'assignedGridDDGroup', + notifyDrop: function (ddSource, e, data) { + //add on target grid + setReportFields(ddSource.dragData.selections) + return true; + } + }); }; function setReportFields(records) { - mainMask.show(); + mainMask.show(); - var PMRow = assignedGrid.getStore().recordType; - var indexes = new Array(); + var PMRow = assignedGrid.getStore().recordType; + var indexes = new Array(); - for (i=0; i < records.length; i++) { - if (!verifyTableLimit()) { - return false; + for (i = 0; i < records.length; i++) { + if (!verifyTableLimit()) { + return false; + } + + var meta = mapPMFieldType(records[i].data['FIELD_UID']); + var typeField = meta.type; + var sizeField = meta.size; + if (records[i].data['FIELD_VALIDATE'].toUpperCase() == 'REAL') { + typeField = 'DOUBLE'; + sizeField = ''; + } + if (records[i].data['FIELD_VALIDATE'].toUpperCase() == 'INT') { + typeField = 'INTEGER'; + } + var row = new PMRow({ + uid: '', + _index: records[i].data['_index'] !== '' ? records[i].data['_index'] : records[i].data['FIELD_DYN'], + field_uid: records[i].data['FIELD_UID'], + field_dyn: records[i].data['FIELD_NAME'], + field_name: records[i].data['FIELD_NAME'].toUpperCase(), + field_label: records[i].data['FIELD_NAME'].toUpperCase(), + field_type: typeField, + field_size: sizeField, + field_key: 0, + field_index: 0, + field_null: 1, + field_filter: 0, + field_autoincrement: 0 + }); + + store.add(row); + indexes.push(records[i].data['_index']); } - var meta = mapPMFieldType(records[i].data['FIELD_UID']); - var typeField = meta.type; - var sizeField = meta.size; - if (records[i].data['FIELD_VALIDATE'].toUpperCase() == 'REAL') { - typeField = 'DOUBLE'; - sizeField = ''; + //remove from source grid + Ext.each(records, availableGrid.store.remove, availableGrid.store); + + if (indexes.length == 0) { + mainMask.hide(); + return; } - if (records[i].data['FIELD_VALIDATE'].toUpperCase() == 'INT') { - typeField = 'INTEGER'; - } - var row = new PMRow({ - uid : '', - _index : records[i].data['_index'] !== '' ? records[i].data['_index'] : records[i].data['FIELD_DYN'], - field_uid : records[i].data['FIELD_UID'], - field_dyn : records[i].data['FIELD_NAME'], - field_name : records[i].data['FIELD_NAME'].toUpperCase(), - field_label : records[i].data['FIELD_NAME'].toUpperCase(), - field_type : typeField, - field_size : sizeField, - field_key : 0, - field_index : 0, - field_null : 1, - field_filter : 0, - field_autoincrement : 0 + + //update on server + Ext.Ajax.request({ + url: '../pmTablesProxy/updateAvDynafields', + params: { + PRO_UID: PRO_UID !== false ? PRO_UID : Ext.getCmp('PROCESS').getValue(), + indexes: indexes.join(','), + isset: false + }, + success: function (resp) { + result = Ext.util.JSON.decode(resp.responseText); + + availableGrid.store.lastOptions.params.loadField = 0; + availableGrid.store.reload(); + } }); - - store.add(row); - indexes.push(records[i].data['_index']); - } - - //remove from source grid - Ext.each(records, availableGrid.store.remove, availableGrid.store); - - if (indexes.length == 0) { - mainMask.hide(); - return; - } - - //update on server - Ext.Ajax.request({ - url: '../pmTablesProxy/updateAvDynafields', - params: { - PRO_UID : PRO_UID !== false? PRO_UID : Ext.getCmp('PROCESS').getValue(), - indexes : indexes.join(','), - isset : false - }, - success: function(resp){ - result = Ext.util.JSON.decode(resp.responseText); - - availableGrid.store.lastOptions.params.loadField = 0; - availableGrid.store.reload(); - } - }); } function unsetReportFields(records) { - mainMask.show(); + mainMask.show(); - var PMRow = availableGrid.getStore().recordType; - var indexes = new Array(); - var recordsUsrDef = new Array(); - var fieldName = ''; + var PMRow = availableGrid.getStore().recordType; + var indexes = new Array(); + var recordsUsrDef = new Array(); + var fieldName = ''; - for (i=0; i < records.length; i++) { - if (records[i].data['field_dyn'] != '') { - var row = new PMRow({ - FIELD_UID: records[i].data['field_uid'], - FIELD_NAME: records[i].data['field_dyn'] - }); - availableGrid.getStore().add(row); - ix = records[i].data['_index'] != '' ? records[i].data['_index'] : records[i].data['field_dyn'] - indexes.push(ix); - } else { - if ( records[i].data['field_name'] == 'APP_UID' - || records[i].data['field_name'] == 'APP_NUMBER' - || records[i].data['field_name'] == 'ROW') - { - records[i] = null; - } - else { - if (records[i].data['field_dyn'] == '' || records[i].data['field_dyn'] == null) { - if (fieldName.length > 0) { - fieldName += ', ' - } - fieldName += records[i].data['field_name']; - recordsUsrDef.push(records[i]); - records[i] = null; + for (i = 0; i < records.length; i++) { + if (records[i].data['field_dyn'] != '') { + var row = new PMRow({ + FIELD_UID: records[i].data['field_uid'], + FIELD_NAME: records[i].data['field_dyn'] + }); + availableGrid.getStore().add(row); + ix = records[i].data['_index'] != '' ? records[i].data['_index'] : records[i].data['field_dyn'] + indexes.push(ix); + } else { + if (records[i].data['field_name'] == 'APP_UID' + || records[i].data['field_name'] == 'APP_NUMBER' + || records[i].data['field_name'] == 'ROW') + { + records[i] = null; + } else { + if (records[i].data['field_dyn'] == '' || records[i].data['field_dyn'] == null) { + if (fieldName.length > 0) { + fieldName += ', ' + } + fieldName += records[i].data['field_name']; + recordsUsrDef.push(records[i]); + records[i] = null; + } + } } - } } - } - Ext.each(records, assignedGrid.store.remove, assignedGrid.store); + Ext.each(records, assignedGrid.store.remove, assignedGrid.store); - if (recordsUsrDef.length > 0 ) { - PMExt.confirm(_('ID_CONFIRM'), _('ID_CONFIRM_REMOVE_FIELDS') + ' ' + fieldName + '?', function(){ - Ext.each(recordsUsrDef, assignedGrid.store.remove, assignedGrid.store); + if (recordsUsrDef.length > 0) { + PMExt.confirm(_('ID_CONFIRM'), _('ID_CONFIRM_REMOVE_FIELDS') + ' ' + fieldName + '?', function () { + Ext.each(recordsUsrDef, assignedGrid.store.remove, assignedGrid.store); + }); + } + + if (indexes.length == 0) { + mainMask.hide(); + return; + } + + //update on server + Ext.Ajax.request({ + url: '../pmTablesProxy/updateAvDynafields', + params: { + PRO_UID: PRO_UID !== false ? PRO_UID : Ext.getCmp('PROCESS').getValue(), + indexes: indexes.join(','), + isset: true + }, + success: function (resp) { + result = Ext.util.JSON.decode(resp.responseText); + + availableGrid.store.lastOptions.params.loadField = 0; + availableGrid.store.reload(); + } }); - } - - if (indexes.length == 0) { - mainMask.hide(); - return; - } - - //update on server - Ext.Ajax.request({ - url: '../pmTablesProxy/updateAvDynafields', - params: { - PRO_UID : PRO_UID !== false? PRO_UID : Ext.getCmp('PROCESS').getValue(), - indexes : indexes.join(','), - isset : true - }, - success: function(resp){ - result = Ext.util.JSON.decode(resp.responseText); - - availableGrid.store.lastOptions.params.loadField = 0; - availableGrid.store.reload(); - } - }); } - function loadTableRowsFromArray(records) { - var PMRow = assignedGrid.getStore().recordType; - if (records.length == 0) return; + var PMRow = assignedGrid.getStore().recordType; + if (records.length == 0) + return; - for (i=0;i= 255 ) { - mainMask.hide(); - PMExt.info(_('ID_NOTICE'), _('ID_MAX_LIMIT_COLUMNS_FOR_DATABASE') ); - assignedGrid._setTitle(); - return false; - } - return true; + if (store.getCount() >= 255) { + mainMask.hide(); + PMExt.info(_('ID_NOTICE'), _('ID_MAX_LIMIT_COLUMNS_FOR_DATABASE')); + assignedGrid._setTitle(); + return false; + } + return true; } function in_array(needle, haystack) { - for(var i in haystack) { - if(haystack[i] == needle) return true; - } - return false; + for (var i in haystack) { + if (haystack[i] == needle) { + return true; + } + } + return false; } From 232c566b67a21057e2185d576f784232ada2edb1 Mon Sep 17 00:00:00 2001 From: dante Date: Mon, 23 Oct 2017 15:01:21 -0400 Subject: [PATCH 55/85] HOR-3960 --- workflow/engine/classes/PmDynaform.php | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/workflow/engine/classes/PmDynaform.php b/workflow/engine/classes/PmDynaform.php index 3ad5a2cf0..2690e71b8 100644 --- a/workflow/engine/classes/PmDynaform.php +++ b/workflow/engine/classes/PmDynaform.php @@ -761,7 +761,12 @@ class PmDynaform } catch (Exception $e) { $this->context["action"] = "execute-sql" . $type; $this->context["exception"] = (array) $e; - \Bootstrap::registerMonolog("sqlExecution", 400, "Sql Execution", $this->context, $this->sysSys, "processmaker.log"); + \Bootstrap::registerMonolog("sqlExecution", + 400, + "Sql Execution", + $this->basicExceptionData($e), + $this->sysSys, + "processmaker.log"); } return $data; } @@ -2155,4 +2160,20 @@ class PmDynaform } } + /** + * Returns an array with the basic fields of the Exception class. It isn't returned any extra fields information + * of any derivated Exception class. This way we have a lightweight version of the exception data that can + * be used when logging the exception, for example. + * @param $e an Exception class derivate + * @return array + */ + private function basicExceptionData($e) + { + $result = []; + $result['code'] = $e->getCode(); + $result['file'] = $e->getFile(); + $result['line'] = $e->getLine(); + $result['message'] = $e->getMessage(); + return $result; + } } From aae6c8a61b6b42d8036723e1b63e2d8a6c062b53 Mon Sep 17 00:00:00 2001 From: dante Date: Mon, 23 Oct 2017 16:38:42 -0400 Subject: [PATCH 56/85] adding some SQLException fields with relevant info of the executed query --- workflow/engine/classes/PmDynaform.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/workflow/engine/classes/PmDynaform.php b/workflow/engine/classes/PmDynaform.php index 2690e71b8..d36597567 100644 --- a/workflow/engine/classes/PmDynaform.php +++ b/workflow/engine/classes/PmDynaform.php @@ -2174,6 +2174,15 @@ class PmDynaform $result['file'] = $e->getFile(); $result['line'] = $e->getLine(); $result['message'] = $e->getMessage(); + + if (property_exists($e, 'nativeError')) { + $result['nativeError'] = $e->getNativeError(); + } + + if (property_exists($e, 'userInfo')) { + $result['nativeError'] = $e->getUserInfo(); + } + return $result; } } From 672a3ee57e9b4f9d05dd015c29a05903b9cfde67 Mon Sep 17 00:00:00 2001 From: dante Date: Tue, 24 Oct 2017 10:01:38 -0400 Subject: [PATCH 57/85] adding the executed query in the exception --- workflow/engine/classes/PmDynaform.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/workflow/engine/classes/PmDynaform.php b/workflow/engine/classes/PmDynaform.php index d36597567..0b6c363da 100644 --- a/workflow/engine/classes/PmDynaform.php +++ b/workflow/engine/classes/PmDynaform.php @@ -764,7 +764,7 @@ class PmDynaform \Bootstrap::registerMonolog("sqlExecution", 400, "Sql Execution", - $this->basicExceptionData($e), + $this->basicExceptionData($e, $sql), $this->sysSys, "processmaker.log"); } @@ -2167,20 +2167,21 @@ class PmDynaform * @param $e an Exception class derivate * @return array */ - private function basicExceptionData($e) + private function basicExceptionData($e, $sql) { $result = []; $result['code'] = $e->getCode(); $result['file'] = $e->getFile(); $result['line'] = $e->getLine(); $result['message'] = $e->getMessage(); + $result['nativeQuery'] = $sql; if (property_exists($e, 'nativeError')) { $result['nativeError'] = $e->getNativeError(); } if (property_exists($e, 'userInfo')) { - $result['nativeError'] = $e->getUserInfo(); + $result['userInfo'] = $e->getUserInfo(); } return $result; From 6e6c9e021878489324974b06708f853a2998f854 Mon Sep 17 00:00:00 2001 From: dante Date: Tue, 24 Oct 2017 10:48:01 -0400 Subject: [PATCH 58/85] adding comment to function parameter --- workflow/engine/classes/PmDynaform.php | 1 + 1 file changed, 1 insertion(+) diff --git a/workflow/engine/classes/PmDynaform.php b/workflow/engine/classes/PmDynaform.php index 0b6c363da..1e4aa37e4 100644 --- a/workflow/engine/classes/PmDynaform.php +++ b/workflow/engine/classes/PmDynaform.php @@ -2165,6 +2165,7 @@ class PmDynaform * of any derivated Exception class. This way we have a lightweight version of the exception data that can * be used when logging the exception, for example. * @param $e an Exception class derivate + * @param $sql query that was executed when the exception was generated * @return array */ private function basicExceptionData($e, $sql) From dc5d17241a5bc475493face4a389bb4b142281dd Mon Sep 17 00:00:00 2001 From: Paula Quispe Date: Tue, 24 Oct 2017 12:57:09 -0400 Subject: [PATCH 59/85] HOR-3900 --- gulliver/system/class.g.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/gulliver/system/class.g.php b/gulliver/system/class.g.php index 096906d9b..827cce26e 100644 --- a/gulliver/system/class.g.php +++ b/gulliver/system/class.g.php @@ -2579,13 +2579,15 @@ class G } /** - * Funtion used to fix 32K issue related to ext3 max subdirectory storage, but checking Version first. + * Function used to fix 32K issue related to ext3 max subdirectory storage, but checking Version first. + * * @param string $uid * @param int $splitSize * @param int $pieces + * * @return string xxx/xxx/xxx/xxxxxxxxxxxxxxxxxxxxx */ - public function getPathFromUID($uid, $splitSize = 3, $pieces = 3) + public static function getPathFromUID($uid, $splitSize = 3, $pieces = 3) { if (! G::gotDirectoryStructureVer2()) { return $uid; @@ -2600,7 +2602,7 @@ class G * @param int $pieces * @return string xxx/xxx/xxx/xxxxxxxxxxxxxxxxxxxxx */ - public function getPathFromUIDPlain($uid, $splitSize = 3, $pieces = 3) + public static function getPathFromUIDPlain($uid, $splitSize = 3, $pieces = 3) { $dirArray = array(); if (is_string($uid) && strlen($uid) >= 32 && $uid != G::getBlackHoleDir()) { @@ -2620,7 +2622,7 @@ class G * @param string $path * @return string */ - public function getUIDfromPath($path) + public static function getUIDfromPath($path) { $uid = ''; $item = explode($path, '/'); @@ -2642,7 +2644,7 @@ class G * @param int $pieces * @return array index:0 got the path, index:1 got the filename */ - public function getPathFromFileUID($appUid, $fileUid, $splitSize = 3, $pieces = 3) + public static function getPathFromFileUID($appUid, $fileUid, $splitSize = 3, $pieces = 3) { if (! G::gotDirectoryStructureVer2()) { $response = array(); From 00cfd4da56d39f5387f326991795a2f88ef518bc Mon Sep 17 00:00:00 2001 From: Paula Quispe Date: Tue, 24 Oct 2017 16:22:23 -0400 Subject: [PATCH 60/85] HOR-2921 --- workflow/engine/classes/WorkspaceTools.php | 1 - workflow/engine/classes/model/AppCacheView.php | 14 -------------- 2 files changed, 15 deletions(-) diff --git a/workflow/engine/classes/WorkspaceTools.php b/workflow/engine/classes/WorkspaceTools.php index a6ddadb55..aa372fcfe 100644 --- a/workflow/engine/classes/WorkspaceTools.php +++ b/workflow/engine/classes/WorkspaceTools.php @@ -856,7 +856,6 @@ class WorkspaceTools if (!$currentUserIsSuper) { $appCache->checkGrantsForUser(true); - $appCache->setSuperForUser($currentUser); $currentUserIsSuper = true; } diff --git a/workflow/engine/classes/model/AppCacheView.php b/workflow/engine/classes/model/AppCacheView.php index 2c851b76c..3690cfca1 100644 --- a/workflow/engine/classes/model/AppCacheView.php +++ b/workflow/engine/classes/model/AppCacheView.php @@ -1260,20 +1260,6 @@ class AppCacheView extends BaseAppCacheView } } - public function setSuperForUser($mysqlUser) - { - try { - $con = Propel::getConnection("root"); - $stmt = $con->createStatement(); - $sql = "GRANT SUPER on *.* to '$mysqlUser' "; - $rs1 = $stmt->executeQuery($sql, ResultSet::FETCHMODE_NUM); - - return array(); - } catch (Exception $e) { - return array('error' => true, 'msg' => $e->getMessage()); - } - } - /** * search for table APP_CACHE_VIEW * @return void From 5b31d90465f70ec5597be262f44dd934c7d2632f Mon Sep 17 00:00:00 2001 From: Paula Quispe Date: Tue, 24 Oct 2017 11:41:46 -0400 Subject: [PATCH 61/85] HOR-3228 --- workflow/engine/bin/tasks/cliWorkspaces.php | 60 ++++++++++++++++----- 1 file changed, 46 insertions(+), 14 deletions(-) diff --git a/workflow/engine/bin/tasks/cliWorkspaces.php b/workflow/engine/bin/tasks/cliWorkspaces.php index 0ef3a3b75..2614137b1 100644 --- a/workflow/engine/bin/tasks/cliWorkspaces.php +++ b/workflow/engine/bin/tasks/cliWorkspaces.php @@ -356,29 +356,61 @@ function run_info($args, $opts) } } +/** + * Check if we need to execute the workspace-upgrade + * If we apply the command for all workspaces, we will need to execute one by one by redefining the constants + * + * @param string $args, workspace name that we need to apply the database-upgrade + * @param string $opts, additional arguments + * + * @return void + */ function run_workspace_upgrade($args, $opts) { - $filter = new InputFilter(); - $opts = $filter->xssFilterHard($opts); - $args = $filter->xssFilterHard($args); - $workspaces = get_workspaces_from_args($args); + //Read the additional parameters for this command + $parameters = ''; + $parameters .= array_key_exists('buildACV', $opts) ? '--buildACV ' : ''; + $parameters .= array_key_exists('noxml', $opts) ? '--no-xml ' : ''; + $parameters .= array_key_exists("lang", $opts) ? 'lang=' . $opts['lang'] : 'lang=' . SYS_LANG; + + //Check if the command is executed by a specific workspace + if (count($args) === 1) { + workspace_upgrade($args, $opts); + } else { + $workspaces = get_workspaces_from_args($args); + foreach ($workspaces as $workspace) { + passthru('./processmaker upgrade ' . $parameters . ' ' . $workspace->name); + } + } +} + +/** + * This function is executed only by one workspace, for the command workspace-upgrade + * + * @param array $args, workspace name for to apply the upgrade + * @param array $opts, specify additional arguments for language, flag for buildACV, flag for noxml + * + * @return void + */ +function workspace_upgrade($args, $opts) { $first = true; + $workspaces = get_workspaces_from_args($args); $lang = array_key_exists("lang", $opts) ? $opts['lang'] : 'en'; $buildCacheView = array_key_exists('buildACV', $opts); $flagUpdateXml = !array_key_exists('noxml', $opts); + $wsName = $workspaces[key($workspaces)]->name; + Bootstrap::setConstantsRelatedWs($wsName); + //Loop, read all the attributes related to the one workspace foreach ($workspaces as $workspace) { try { - if (empty(config("system.workspace"))) { - define("SYS_SYS", $workspace->name); - config(["system.workspace" => $workspace->name]); - } - - if (!defined("PATH_DATA_SITE")) { - define("PATH_DATA_SITE", PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP); - } - - $workspace->upgrade($buildCacheView, $workspace->name, false, $lang, ['updateXml' => $flagUpdateXml, 'updateMafe' => $first]); + $workspace->upgrade( + $buildCacheView, + $workspace->name, + false, + $lang, + ['updateXml' => $flagUpdateXml, 'updateMafe' => $first] + ); $first = false; $flagUpdateXml = false; } catch (Exception $e) { From 81fc730cdb24f1720b398f98ed4dc4fa1b8f74d5 Mon Sep 17 00:00:00 2001 From: Paula Quispe Date: Mon, 23 Oct 2017 14:23:31 -0400 Subject: [PATCH 62/85] HOR-3521 --- workflow/engine/classes/model/ListInbox.php | 16 ++++++++-- .../classes/model/ListParticipatedLast.php | 16 ++++++++-- workflow/engine/classes/model/ListPaused.php | 16 ++++++++-- .../src/ProcessMaker/BusinessModel/Cases.php | 32 +++++++++++++------ 4 files changed, 61 insertions(+), 19 deletions(-) diff --git a/workflow/engine/classes/model/ListInbox.php b/workflow/engine/classes/model/ListInbox.php index b831c6973..47362ea9f 100644 --- a/workflow/engine/classes/model/ListInbox.php +++ b/workflow/engine/classes/model/ListInbox.php @@ -623,10 +623,20 @@ class ListInbox extends BaseListInbox $limit = isset($filters['limit']) ? $filters['limit'] : "25"; $paged = isset($filters['paged']) ? $filters['paged'] : 1; - if ($dir == "DESC") { - $criteria->addDescendingOrderByColumn($sort); + if (is_array($sort) && count($sort) > 0) { + foreach ($sort as $key) { + if ($dir == 'DESC') { + $criteria->addDescendingOrderByColumn($key); + } else { + $criteria->addAscendingOrderByColumn($key); + } + } } else { - $criteria->addAscendingOrderByColumn($sort); + if ($dir == 'DESC') { + $criteria->addDescendingOrderByColumn($sort); + } else { + $criteria->addAscendingOrderByColumn($sort); + } } if ($paged == 1) { diff --git a/workflow/engine/classes/model/ListParticipatedLast.php b/workflow/engine/classes/model/ListParticipatedLast.php index 230c48f3d..81d3ed331 100644 --- a/workflow/engine/classes/model/ListParticipatedLast.php +++ b/workflow/engine/classes/model/ListParticipatedLast.php @@ -466,10 +466,20 @@ class ListParticipatedLast extends BaseListParticipatedLast $limit = isset($filters['limit']) ? $filters['limit'] : '25'; $paged = isset($filters['paged']) ? $filters['paged'] : 1; - if ($dir == 'DESC') { - $criteria->addDescendingOrderByColumn($sort); + if (is_array($sort) && count($sort) > 0) { + foreach ($sort as $key) { + if ($dir == 'DESC') { + $criteria->addDescendingOrderByColumn($key); + } else { + $criteria->addAscendingOrderByColumn($key); + } + } } else { - $criteria->addAscendingOrderByColumn($sort); + if ($dir == 'DESC') { + $criteria->addDescendingOrderByColumn($sort); + } else { + $criteria->addAscendingOrderByColumn($sort); + } } if ($paged == 1) { diff --git a/workflow/engine/classes/model/ListPaused.php b/workflow/engine/classes/model/ListPaused.php index 804bde419..edaf5336c 100644 --- a/workflow/engine/classes/model/ListPaused.php +++ b/workflow/engine/classes/model/ListPaused.php @@ -376,10 +376,20 @@ class ListPaused extends BaseListPaused $limit = isset($filters['limit']) ? $filters['limit'] : "25"; $paged = isset($filters['paged']) ? $filters['paged'] : 1; - if ($dir == "DESC") { - $criteria->addDescendingOrderByColumn($sort); + if (is_array($sort) && count($sort) > 0) { + foreach ($sort as $key) { + if ($dir == 'DESC') { + $criteria->addDescendingOrderByColumn($key); + } else { + $criteria->addAscendingOrderByColumn($key); + } + } } else { - $criteria->addAscendingOrderByColumn($sort); + if ($dir == 'DESC') { + $criteria->addDescendingOrderByColumn($sort); + } else { + $criteria->addAscendingOrderByColumn($sort); + } } if ($paged == 1) { diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php b/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php index 84c4be55e..3beb9067b 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php @@ -3547,7 +3547,7 @@ class Cases * @param array $additionalColumns, columns related to the custom cases list with the format TABLE_NAME.COLUMN_NAME * @param string $userDisplayFormat, user information display format * - * @return string $tableName + * @return string|array could be an string $tableName, could be an array $columnSort */ public function getSortColumn( $listPeer, @@ -3598,11 +3598,11 @@ class Cases * @param string $format, the user display format * @param string $prefix, the initial name of the columns related to the USR_FIRSTNAME USR_LASTNAME USR_USERNAME * - * @return string $columnSort, columns by apply the sql command ORDER BY + * @return array $columnSort, columns by apply the sql command ORDER BY */ public function buildOrderFieldFormatted($columnsList, $format, $prefix = 'DEL_PREVIOUS_') { - $columnSort = ''; + $columnSort = []; if (in_array($prefix . 'USR_FIRSTNAME', $columnsList) && in_array($prefix . 'USR_LASTNAME', $columnsList) && @@ -3610,25 +3610,37 @@ class Cases ) { switch ($format) { case '@firstName @lastName': - $columnSort = $prefix . 'USR_FIRSTNAME' . ',' . $prefix . 'USR_LASTNAME'; + array_push($columnSort, $prefix . 'USR_FIRSTNAME'); + array_push($columnSort, $prefix . 'USR_LASTNAME'); break; case '@firstName @lastName (@userName)': - $columnSort = $prefix . 'USR_FIRSTNAME' . ',' . $prefix . 'USR_LASTNAME' . ',' . $prefix . 'USR_USERNAME'; + array_push($columnSort, $prefix . 'USR_FIRSTNAME'); + array_push($columnSort, $prefix . 'USR_LASTNAME'); + array_push($columnSort, $prefix . 'USR_USERNAME'); break; case '@userName': - $columnSort = $prefix . 'USR_USERNAME'; + array_push($columnSort, $prefix . 'USR_USERNAME'); break; case '@userName (@firstName @lastName)': - $columnSort = $prefix . 'USR_USERNAME' . ',' . $prefix . 'USR_FIRSTNAME' . ',' . $prefix . 'USR_LASTNAME'; + array_push($columnSort, $prefix . 'USR_USERNAME'); + array_push($columnSort, $prefix . 'USR_FIRSTNAME'); + array_push($columnSort, $prefix . 'USR_LASTNAME'); break; case '@lastName, @firstName': - $columnSort = $prefix . 'USR_LASTNAME' . ',' . $prefix . 'USR_FIRSTNAME'; + array_push($columnSort, $prefix . 'USR_LASTNAME'); + array_push($columnSort, $prefix . 'USR_FIRSTNAME'); + break; + case '@lastName @firstName': + array_push($columnSort, $prefix . 'USR_LASTNAME'); + array_push($columnSort, $prefix . 'USR_FIRSTNAME'); break; case '@lastName, @firstName (@userName)': - $columnSort = $prefix . 'USR_LASTNAME' . ',' . $prefix . 'USR_FIRSTNAME' . ',' . $prefix . 'USR_USERNAME'; + array_push($columnSort, $prefix . 'USR_LASTNAME'); + array_push($columnSort, $prefix . 'USR_FIRSTNAME'); + array_push($columnSort, $prefix . 'USR_USERNAME'); break; default: - $columnSort = $prefix . 'USR_USERNAME'; + array_push($columnSort, $prefix . 'USR_USERNAME'); break; } } From 44c81b32b13c261d8e8f48de879fc5b40579330c Mon Sep 17 00:00:00 2001 From: Paula Quispe Date: Thu, 26 Oct 2017 12:30:58 -0400 Subject: [PATCH 63/85] HOR-3916 --- workflow/engine/classes/Cases.php | 67 ++++++++++++++++++++----------- 1 file changed, 44 insertions(+), 23 deletions(-) diff --git a/workflow/engine/classes/Cases.php b/workflow/engine/classes/Cases.php index 9eccb3e89..4d3307f69 100644 --- a/workflow/engine/classes/Cases.php +++ b/workflow/engine/classes/Cases.php @@ -5738,7 +5738,7 @@ class Cases "MSGS_HISTORY" => array() /*----------------------------------********---------------------------------*/ , "SUMMARY_FORM" => 0 - /*----------------------------------********---------------------------------*/ + /*----------------------------------********---------------------------------*/ ); $oObjectPermission = new ObjectPermission(); @@ -5746,6 +5746,14 @@ class Cases $groupPermissions = $oObjectPermission->verifyObjectPermissionPerGroup($usrUid, $proUid, $tasUid, $action, $caseData); $permissions = array_merge($userPermissions, $groupPermissions); + $resultDynaforms = []; + $resultInputs = []; + $resultAttachments = []; + $resultOutputs = []; + $resultCaseNotes = []; + $resultSummary = []; + $resultMessages = []; + foreach ($permissions as $row) { $userUid = $row['USR_UID']; $opUserRelation = $row['OP_USER_RELATION']; @@ -5779,14 +5787,16 @@ class Cases switch ($opType) { case 'ANY': //For dynaforms - $result['DYNAFORM'] = $oObjectPermission->objectPermissionByDynaform( + $listDynaform = $oObjectPermission->objectPermissionByDynaform( $appUid, $opTaskSource, $opObjUid, $caseData['APP_STATUS'] ); + $resultDynaforms = array_merge($resultDynaforms, $listDynaform); + //For Ouputs - $result['OUTPUT'] = $oObjectPermission->objectPermissionByOutputInput( + $listOutput = $oObjectPermission->objectPermissionByOutputInput( $appUid, $proUid, $opTaskSource, @@ -5794,8 +5804,10 @@ class Cases $opObjUid, $caseData['APP_STATUS'] ); + $resultOutputs = array_merge($resultOutputs, $listOutput); + //For Inputs - $result['INPUT'] = $oObjectPermission->objectPermissionByOutputInput( + $listInput = $oObjectPermission->objectPermissionByOutputInput( $appUid, $proUid, $opTaskSource, @@ -5803,8 +5815,10 @@ class Cases $opObjUid, $caseData['APP_STATUS'] ); + $resultInputs = array_merge($resultInputs, $listInput); + //For Attachment - $result['ATTACHMENT'] = $oObjectPermission->objectPermissionByOutputInput( + $listAttchment = $oObjectPermission->objectPermissionByOutputInput( $appUid, $proUid, $opTaskSource, @@ -5812,14 +5826,15 @@ class Cases $opObjUid, $caseData['APP_STATUS'] ); + $resultAttachments = array_merge($resultAttachments, $listAttchment); - $result['CASES_NOTES'] = 1; + $resultCaseNotes = 1; /*----------------------------------********---------------------------------*/ - $result['SUMMARY_FORM'] = 1; + $resultSummary = 1; /*----------------------------------********---------------------------------*/ //Message History - $result['MSGS_HISTORY'] = $oObjectPermission->objectPermissionMessage( + $listMessage = $oObjectPermission->objectPermissionMessage( $appUid, $proUid, $userUid, @@ -5829,17 +5844,19 @@ class Cases $caseData['APP_STATUS'], $opParticipated ); + $resultMessages = array_merge($resultMessages, $listMessage); break; case 'DYNAFORM': - $result['DYNAFORM'] = $oObjectPermission->objectPermissionByDynaform( + $listDynaform = $oObjectPermission->objectPermissionByDynaform( $appUid, $opTaskSource, $opObjUid, $caseData['APP_STATUS'] ); + $resultDynaforms = array_merge($resultDynaforms, $listDynaform); break; case 'INPUT': - $result['INPUT'] = $oObjectPermission->objectPermissionByOutputInput( + $listInput= $oObjectPermission->objectPermissionByOutputInput( $appUid, $proUid, $opTaskSource, @@ -5847,9 +5864,10 @@ class Cases $opObjUid, $caseData['APP_STATUS'] ); + $resultInputs = array_merge($resultInputs, $listInput); break; case 'ATTACHMENT': - $result['ATTACHMENT'] = $oObjectPermission->objectPermissionByOutputInput( + $listAttchment= $oObjectPermission->objectPermissionByOutputInput( $appUid, $proUid, $opTaskSource, @@ -5857,9 +5875,10 @@ class Cases $opObjUid, $caseData['APP_STATUS'] ); + $resultAttachments = array_merge($resultAttachments, $listAttchment); break; case 'OUTPUT': - $result['OUTPUT'] = $oObjectPermission->objectPermissionByOutputInput( + $listOutput = $oObjectPermission->objectPermissionByOutputInput( $appUid, $proUid, $opTaskSource, @@ -5867,17 +5886,18 @@ class Cases $opObjUid, $caseData['APP_STATUS'] ); + $resultOutputs = array_merge($resultOutputs, $listOutput); break; case 'CASES_NOTES': - $result['CASES_NOTES'] = 1; + $resultCaseNotes = 1; break; /*----------------------------------********---------------------------------*/ case 'SUMMARY_FORM': - $result['SUMMARY_FORM'] = 1; + $resultSummary = 1; break; /*----------------------------------********---------------------------------*/ case 'MSGS_HISTORY': - $result['MSGS_HISTORY'] = $oObjectPermission->objectPermissionMessage( + $listMessage = $oObjectPermission->objectPermissionMessage( $appUid, $proUid, $userUid, @@ -5887,21 +5907,22 @@ class Cases $caseData['APP_STATUS'], $opParticipated ); + $resultMessages = array_merge($resultMessages, $listMessage); break; } } } return array( - "DYNAFORMS" => $result['DYNAFORM'], - "INPUT_DOCUMENTS" => $result['INPUT'], - "ATTACHMENTS" => $result['ATTACHMENT'], - "OUTPUT_DOCUMENTS" => $result['OUTPUT'], - "CASES_NOTES" => $result['CASES_NOTES'], - "MSGS_HISTORY" => $result['MSGS_HISTORY'] + "DYNAFORMS" => $resultDynaforms, + "INPUT_DOCUMENTS" => $resultInputs, + "ATTACHMENTS" => $resultAttachments, + "OUTPUT_DOCUMENTS" => $resultOutputs, + "CASES_NOTES" => $resultCaseNotes, + "MSGS_HISTORY" => $resultMessages + /*----------------------------------********---------------------------------*/ + , "SUMMARY_FORM" => $resultSummary /*----------------------------------********---------------------------------*/ - , "SUMMARY_FORM" => $result['SUMMARY_FORM'] - /*----------------------------------********---------------------------------*/ ); } From de7a0190d23285d87283fb1e4ebe81d3e679ac1d Mon Sep 17 00:00:00 2001 From: Paula Quispe Date: Thu, 26 Oct 2017 13:44:16 -0400 Subject: [PATCH 64/85] Code Style --- workflow/engine/classes/Cases.php | 127 +++++++++++++++--------------- 1 file changed, 62 insertions(+), 65 deletions(-) diff --git a/workflow/engine/classes/Cases.php b/workflow/engine/classes/Cases.php index 4d3307f69..f4d86e6c4 100644 --- a/workflow/engine/classes/Cases.php +++ b/workflow/engine/classes/Cases.php @@ -5664,48 +5664,55 @@ class Cases /** * Obtain all user permits for Dynaforms, Input and output documents + * function getAllObjects ($proUid, $appUid, $tasUid, $usrUid) * - * function getAllObjects ($PRO_UID, $APP_UID, $TAS_UID, $USR_UID) - * @author Erik Amaru Ortiz * @access public - * @param Process ID, Application ID, Task ID and User ID - * @return Array within all user permitions all objects' types + * @param string $proUid, Process ID + * @param string $appUid, Application ID, + * @param string $tasUid, Task ID + * @param string $usrUid, User ID + * @param integer $delIndex, User ID + * + * @return array within all user permissions all objects' types */ - public function getAllObjects($PRO_UID, $APP_UID, $TAS_UID = '', $USR_UID = '', $delIndex = 0) + public function getAllObjects($proUid, $appUid, $tasUid = '', $usrUid = '', $delIndex = 0) { - $ACTIONS = array('VIEW', 'BLOCK', 'DELETE'); //TO COMPLETE - $MAIN_OBJECTS = array(); - $RESULT_OBJECTS = array(); + $permissionAction = ['VIEW', 'BLOCK', 'DELETE']; //TO COMPLETE + $mainObjects = []; + $resultObjects = []; - foreach ($ACTIONS as $action) { - $MAIN_OBJECTS[$action] = $this->getAllObjectsFrom($PRO_UID, $APP_UID, $TAS_UID, $USR_UID, $action, $delIndex); + foreach ($permissionAction as $action) { + $mainObjects[$action] = $this->getAllObjectsFrom($proUid, $appUid, $tasUid, $usrUid, $action, $delIndex); } - /* ADDITIONAL OPERATIONS */ - /* * * BETWEN VIEW AND BLOCK** */ - $RESULT_OBJECTS['DYNAFORMS'] = G::arrayDiff( - $MAIN_OBJECTS['VIEW']['DYNAFORMS'], $MAIN_OBJECTS['BLOCK']['DYNAFORMS'] + //We will review data with VIEW and BLOCK + //Dynaforms BLOCK it means does not show in the list + $resultObjects['DYNAFORMS'] = G::arrayDiff( + $mainObjects['VIEW']['DYNAFORMS'], $mainObjects['BLOCK']['DYNAFORMS'] ); - $RESULT_OBJECTS['INPUT_DOCUMENTS'] = G::arrayDiff( - $MAIN_OBJECTS['VIEW']['INPUT_DOCUMENTS'], $MAIN_OBJECTS['BLOCK']['INPUT_DOCUMENTS'] + //Input BLOCK it means does not show in the list + $resultObjects['INPUT_DOCUMENTS'] = G::arrayDiff( + $mainObjects['VIEW']['INPUT_DOCUMENTS'], $mainObjects['BLOCK']['INPUT_DOCUMENTS'] ); - $RESULT_OBJECTS['OUTPUT_DOCUMENTS'] = array_merge_recursive( - G::arrayDiff($MAIN_OBJECTS['VIEW']['OUTPUT_DOCUMENTS'], $MAIN_OBJECTS['BLOCK']['OUTPUT_DOCUMENTS']), G::arrayDiff($MAIN_OBJECTS['DELETE']['OUTPUT_DOCUMENTS'], $MAIN_OBJECTS['BLOCK']['OUTPUT_DOCUMENTS']) + //Output BLOCK it means does not show in the list + $resultObjects['OUTPUT_DOCUMENTS'] = array_merge_recursive( + G::arrayDiff($mainObjects['VIEW']['OUTPUT_DOCUMENTS'], $mainObjects['BLOCK']['OUTPUT_DOCUMENTS']), G::arrayDiff($mainObjects['DELETE']['OUTPUT_DOCUMENTS'], $mainObjects['BLOCK']['OUTPUT_DOCUMENTS']) ); - $RESULT_OBJECTS['CASES_NOTES'] = G::arrayDiff( - $MAIN_OBJECTS['VIEW']['CASES_NOTES'], $MAIN_OBJECTS['BLOCK']['CASES_NOTES'] + //Case notes BLOCK it means does not show in the list + $resultObjects['CASES_NOTES'] = G::arrayDiff( + $mainObjects['VIEW']['CASES_NOTES'], $mainObjects['BLOCK']['CASES_NOTES'] ); - array_push($RESULT_OBJECTS["DYNAFORMS"], -1, -2); - array_push($RESULT_OBJECTS['INPUT_DOCUMENTS'], -1); - array_push($RESULT_OBJECTS['OUTPUT_DOCUMENTS'], -1); - array_push($RESULT_OBJECTS['CASES_NOTES'], -1); + array_push($resultObjects["DYNAFORMS"], -1, -2); + array_push($resultObjects['INPUT_DOCUMENTS'], -1); + array_push($resultObjects['OUTPUT_DOCUMENTS'], -1); + array_push($resultObjects['CASES_NOTES'], -1); - return $RESULT_OBJECTS; + return $resultObjects; } /** * Obtain all object permissions for Dynaforms, Input, Output and Message history - * * This function return information about a specific object permissions or for all = ANY + * * @access public * @param string $proUid * @param string $appUid @@ -5713,6 +5720,7 @@ class Cases * @param string $usrUid * @param string $action some action [VIEW, BLOCK, RESEND] * @param integer $delIndex + * * @return array within all user permissions all objects' types */ public function getAllObjectsFrom($proUid, $appUid, $tasUid = '', $usrUid = '', $action = '', $delIndex = 0) @@ -5727,31 +5735,20 @@ class Cases } } - $userPermissions = array(); - $groupPermissions = array(); - $result = array( - "DYNAFORM" => array(), - "INPUT" => array(), - "ATTACHMENT" => array(), - "OUTPUT" => array(), - "CASES_NOTES" => 0, - "MSGS_HISTORY" => array() - /*----------------------------------********---------------------------------*/ - , "SUMMARY_FORM" => 0 - /*----------------------------------********---------------------------------*/ - ); + $userPermissions = []; + $groupPermissions = []; - $oObjectPermission = new ObjectPermission(); - $userPermissions = $oObjectPermission->verifyObjectPermissionPerUser($usrUid, $proUid, $tasUid, $action, $caseData); - $groupPermissions = $oObjectPermission->verifyObjectPermissionPerGroup($usrUid, $proUid, $tasUid, $action, $caseData); + $objectPermission = new ObjectPermission(); + $userPermissions = $objectPermission->verifyObjectPermissionPerUser($usrUid, $proUid, $tasUid, $action, $caseData); + $groupPermissions = $objectPermission->verifyObjectPermissionPerGroup($usrUid, $proUid, $tasUid, $action, $caseData); $permissions = array_merge($userPermissions, $groupPermissions); $resultDynaforms = []; $resultInputs = []; $resultAttachments = []; $resultOutputs = []; - $resultCaseNotes = []; - $resultSummary = []; + $resultCaseNotes = 0; + $resultSummary = 0; $resultMessages = []; foreach ($permissions as $row) { @@ -5766,28 +5763,28 @@ class Cases //The values of obCaseStatus is [ALL, COMPLETED, DRAFT, TO_DO, PAUSED] //If the case is todo and we need the participate //but we did not participated did not validate nothing and return array empty - $sw_participate = false; // must be false for default + $swParticipate = false; // must be false for default if ($obCaseStatus != 'COMPLETED' && $opParticipated == 1) { - $oCriteriax = new Criteria('workflow'); - $oCriteriax->add(AppDelegationPeer::USR_UID, $usrUid); - $oCriteriax->add(AppDelegationPeer::APP_UID, $appUid); - $datasetx = AppDelegationPeer::doSelectRS($oCriteriax); - $datasetx->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $datasetx->next(); - $aRow = $datasetx->getRow(); - if (!is_array($aRow)) { + $criteria = new Criteria('workflow'); + $criteria->add(AppDelegationPeer::USR_UID, $usrUid); + $criteria->add(AppDelegationPeer::APP_UID, $appUid); + $dataset = AppDelegationPeer::doSelectRS($criteria); + $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $dataset->next(); + $row = $dataset->getRow(); + if (!is_array($row)) { //The user was not participated in the case and the participation is required - $sw_participate = true; + $swParticipate = true; } } //If user can be see the objects process //We will be prepare the data relate to the Type can be ANY, DYNAFORM, INPUT, OUTPUT, ... - if (!$sw_participate) { + if (!$swParticipate) { switch ($opType) { case 'ANY': //For dynaforms - $listDynaform = $oObjectPermission->objectPermissionByDynaform( + $listDynaform = $objectPermission->objectPermissionByDynaform( $appUid, $opTaskSource, $opObjUid, @@ -5796,7 +5793,7 @@ class Cases $resultDynaforms = array_merge($resultDynaforms, $listDynaform); //For Ouputs - $listOutput = $oObjectPermission->objectPermissionByOutputInput( + $listOutput = $objectPermission->objectPermissionByOutputInput( $appUid, $proUid, $opTaskSource, @@ -5807,7 +5804,7 @@ class Cases $resultOutputs = array_merge($resultOutputs, $listOutput); //For Inputs - $listInput = $oObjectPermission->objectPermissionByOutputInput( + $listInput = $objectPermission->objectPermissionByOutputInput( $appUid, $proUid, $opTaskSource, @@ -5818,7 +5815,7 @@ class Cases $resultInputs = array_merge($resultInputs, $listInput); //For Attachment - $listAttchment = $oObjectPermission->objectPermissionByOutputInput( + $listAttchment = $objectPermission->objectPermissionByOutputInput( $appUid, $proUid, $opTaskSource, @@ -5834,7 +5831,7 @@ class Cases /*----------------------------------********---------------------------------*/ //Message History - $listMessage = $oObjectPermission->objectPermissionMessage( + $listMessage = $objectPermission->objectPermissionMessage( $appUid, $proUid, $userUid, @@ -5847,7 +5844,7 @@ class Cases $resultMessages = array_merge($resultMessages, $listMessage); break; case 'DYNAFORM': - $listDynaform = $oObjectPermission->objectPermissionByDynaform( + $listDynaform = $objectPermission->objectPermissionByDynaform( $appUid, $opTaskSource, $opObjUid, @@ -5856,7 +5853,7 @@ class Cases $resultDynaforms = array_merge($resultDynaforms, $listDynaform); break; case 'INPUT': - $listInput= $oObjectPermission->objectPermissionByOutputInput( + $listInput = $objectPermission->objectPermissionByOutputInput( $appUid, $proUid, $opTaskSource, @@ -5867,7 +5864,7 @@ class Cases $resultInputs = array_merge($resultInputs, $listInput); break; case 'ATTACHMENT': - $listAttchment= $oObjectPermission->objectPermissionByOutputInput( + $listAttchment = $objectPermission->objectPermissionByOutputInput( $appUid, $proUid, $opTaskSource, @@ -5878,7 +5875,7 @@ class Cases $resultAttachments = array_merge($resultAttachments, $listAttchment); break; case 'OUTPUT': - $listOutput = $oObjectPermission->objectPermissionByOutputInput( + $listOutput = $objectPermission->objectPermissionByOutputInput( $appUid, $proUid, $opTaskSource, @@ -5897,7 +5894,7 @@ class Cases break; /*----------------------------------********---------------------------------*/ case 'MSGS_HISTORY': - $listMessage = $oObjectPermission->objectPermissionMessage( + $listMessage= $objectPermission->objectPermissionMessage( $appUid, $proUid, $userUid, From 4975028229e50c4a88b35d100e6447b3519833d6 Mon Sep 17 00:00:00 2001 From: Paula Quispe Date: Fri, 27 Oct 2017 13:05:06 -0400 Subject: [PATCH 65/85] Spelling --- workflow/engine/classes/Cases.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/workflow/engine/classes/Cases.php b/workflow/engine/classes/Cases.php index f4d86e6c4..6fae23faf 100644 --- a/workflow/engine/classes/Cases.php +++ b/workflow/engine/classes/Cases.php @@ -5815,7 +5815,7 @@ class Cases $resultInputs = array_merge($resultInputs, $listInput); //For Attachment - $listAttchment = $objectPermission->objectPermissionByOutputInput( + $listAttachment = $objectPermission->objectPermissionByOutputInput( $appUid, $proUid, $opTaskSource, @@ -5823,7 +5823,7 @@ class Cases $opObjUid, $caseData['APP_STATUS'] ); - $resultAttachments = array_merge($resultAttachments, $listAttchment); + $resultAttachments = array_merge($resultAttachments, $listAttachment); $resultCaseNotes = 1; /*----------------------------------********---------------------------------*/ @@ -5864,7 +5864,7 @@ class Cases $resultInputs = array_merge($resultInputs, $listInput); break; case 'ATTACHMENT': - $listAttchment = $objectPermission->objectPermissionByOutputInput( + $listAttachment = $objectPermission->objectPermissionByOutputInput( $appUid, $proUid, $opTaskSource, @@ -5872,7 +5872,7 @@ class Cases $opObjUid, $caseData['APP_STATUS'] ); - $resultAttachments = array_merge($resultAttachments, $listAttchment); + $resultAttachments = array_merge($resultAttachments, $listAttachment); break; case 'OUTPUT': $listOutput = $objectPermission->objectPermissionByOutputInput( From 70a0106ee80890da8d08e2b31cb9db42c94c814b Mon Sep 17 00:00:00 2001 From: Marco Antonio Nina Mena Date: Fri, 27 Oct 2017 14:17:11 -0400 Subject: [PATCH 66/85] HOR-4005 Rename title of dialog from "Upload Variable" to "Select Variable" - Add label --- .../engine/content/translations/english/processmaker.en.po | 6 ++++++ workflow/engine/data/mysql/insert.sql | 3 ++- workflow/engine/methods/controls/varsAjax.php | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/workflow/engine/content/translations/english/processmaker.en.po b/workflow/engine/content/translations/english/processmaker.en.po index 67d079854..7a2549f48 100644 --- a/workflow/engine/content/translations/english/processmaker.en.po +++ b/workflow/engine/content/translations/english/processmaker.en.po @@ -51758,3 +51758,9 @@ msgstr "Flow" #: LABEL/ID_MAFE_f775fa07e143b2e671946a48af8f42ca msgid "versioning" msgstr "versioning" + +# TRANSLATION +# LABEL/ID_SELECT_VARIABLE +#: LABEL/ID_SELECT_VARIABLE +msgid "Select Variable" +msgstr "Select Variable" diff --git a/workflow/engine/data/mysql/insert.sql b/workflow/engine/data/mysql/insert.sql index f52b7ff23..5987a4ce5 100644 --- a/workflow/engine/data/mysql/insert.sql +++ b/workflow/engine/data/mysql/insert.sql @@ -6285,7 +6285,8 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_e6fe2cb291ace4c56d3f9481b3b963af','en','Select a language','2017-10-25') , ( 'LABEL','ID_MAFE_e9cb217697088a98b1937d111d936281','en','Attachment','2017-10-25') , ( 'LABEL','ID_MAFE_f1a76f66cca677c6e628d9ca58a6c8fc','en','Flow','2017-10-25') , -( 'LABEL','ID_MAFE_f775fa07e143b2e671946a48af8f42ca','en','versioning','2017-10-25') ; +( 'LABEL','ID_MAFE_f775fa07e143b2e671946a48af8f42ca','en','versioning','2017-10-25') +( 'LABEL','ID_SELECT_VARIABLE','en','Select Variable','2017-10-27'); INSERT INTO ISO_LOCATION (IC_UID,IL_UID,IL_NAME,IL_NORMAL_NAME,IS_UID) VALUES ('AD','','',' ','') , diff --git a/workflow/engine/methods/controls/varsAjax.php b/workflow/engine/methods/controls/varsAjax.php index e83f1d71f..906363903 100644 --- a/workflow/engine/methods/controls/varsAjax.php +++ b/workflow/engine/methods/controls/varsAjax.php @@ -35,7 +35,7 @@ $_REQUEST['sSymbol']= isset($_REQUEST["sSymbol"])?$_REQUEST["sSymbol"]:''; $_SERVER["QUERY_STRING"] = $filter->xssFilterHard($_SERVER["QUERY_STRING"]); -$html = 'Upload Variable'; +$html = '' . G::LoadTranslation('ID_SELECT_VARIABLE') . ''; $html .= '
'; $html .= '
'; $html .= ''; From 9bce946d6e7a5e492a5c650240c45fe466bdaefa Mon Sep 17 00:00:00 2001 From: Marco Antonio Nina Mena Date: Fri, 27 Oct 2017 14:46:10 -0400 Subject: [PATCH 67/85] HOR-3887 Ux: problems with caseNotes the label for "Posted at" and large text - add tag {litetal} for translate --- .../engine/skinEngine/simplified/templates/appListSearch.html | 2 +- workflow/engine/templates/home/appList.html | 2 +- workflow/engine/templates/home/appListSearch.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/workflow/engine/skinEngine/simplified/templates/appListSearch.html b/workflow/engine/skinEngine/simplified/templates/appListSearch.html index 4a758d247..5ac2a8ef2 100644 --- a/workflow/engine/skinEngine/simplified/templates/appListSearch.html +++ b/workflow/engine/skinEngine/simplified/templates/appListSearch.html @@ -219,7 +219,7 @@ '
' + '

'+r.USR_FIRSTNAME+' '+r.USR_LASTNAME+' ('+r.USR_USERNAME+')

' + '

'+r.NOTE_CONTENT+'
' + - '
{translate label="ID_POSTED_AT"} '+r.NOTE_DATE+'
' + + '
{/literal}{translate label="ID_POSTED_AT"}{literal} ' + r.NOTE_DATE + '
' + '
'; content.append(s); diff --git a/workflow/engine/templates/home/appList.html b/workflow/engine/templates/home/appList.html index f5552928b..dbf895de4 100644 --- a/workflow/engine/templates/home/appList.html +++ b/workflow/engine/templates/home/appList.html @@ -126,7 +126,7 @@ '' + '

'+r.USR_FIRSTNAME+' '+r.USR_LASTNAME+' ('+r.USR_USERNAME+')

' + '

'+r.NOTE_CONTENT+'
' + - '
{translate label="ID_POSTED_AT"} '+r.NOTE_DATE+'
' + + '
{/literal}{translate label="ID_POSTED_AT"}{literal} ' + r.NOTE_DATE + '
' + ''; content.append(s); diff --git a/workflow/engine/templates/home/appListSearch.html b/workflow/engine/templates/home/appListSearch.html index ecb61fb7f..ef94792d1 100644 --- a/workflow/engine/templates/home/appListSearch.html +++ b/workflow/engine/templates/home/appListSearch.html @@ -219,7 +219,7 @@ '' + '

'+r.USR_FIRSTNAME+' '+r.USR_LASTNAME+' ('+r.USR_USERNAME+')

' + '

'+r.NOTE_CONTENT+'
' + - '
{translate label="ID_POSTED_AT"} '+r.NOTE_DATE+'
' + + '
{/literal}{translate label="ID_POSTED_AT"}{literal} ' + r.NOTE_DATE + '
' + ''; content.append(s); From b6de60dd78baa2ed407a245cff0c99be1764621d Mon Sep 17 00:00:00 2001 From: Marco Antonio Nina Mena Date: Fri, 27 Oct 2017 15:18:04 -0400 Subject: [PATCH 68/85] HOR-2572 Unnecessary folder creation on files - Deleted code for creation of folder 'tmp' --- workflow/engine/methods/cases/caseHistory_Ajax.php | 2 -- workflow/engine/methods/cases/caseMessageHistory_Ajax.php | 2 -- 2 files changed, 4 deletions(-) diff --git a/workflow/engine/methods/cases/caseHistory_Ajax.php b/workflow/engine/methods/cases/caseHistory_Ajax.php index 30312621b..6b1f948f8 100644 --- a/workflow/engine/methods/cases/caseHistory_Ajax.php +++ b/workflow/engine/methods/cases/caseHistory_Ajax.php @@ -48,8 +48,6 @@ if ($actionAjax == 'historyGridList_JXP') { $aProcesses[] = $result; } - $newDir = '/tmp/test/directory'; - G::verifyPath($newDir); $r = new stdclass(); $r->data = \ProcessMaker\Util\DateTime::convertUtcToTimeZone($aProcesses); $r->totalCount = $totalCount; diff --git a/workflow/engine/methods/cases/caseMessageHistory_Ajax.php b/workflow/engine/methods/cases/caseMessageHistory_Ajax.php index 8a9c4f268..25017017d 100644 --- a/workflow/engine/methods/cases/caseMessageHistory_Ajax.php +++ b/workflow/engine/methods/cases/caseMessageHistory_Ajax.php @@ -108,8 +108,6 @@ if ($actionAjax == 'messageHistoryGridList_JXP') { $aProcesses = array_splice($aProcesses, $_REQUEST['start'], $_REQUEST['limit']); - $newDir = '/tmp/test/directory'; - G::verifyPath( $newDir ); $r = new stdclass(); $r->data = $aProcesses; $r->totalCount = $totalCount; From 7454e29bb9bdc27312c1c586f92fd7b669939556 Mon Sep 17 00:00:00 2001 From: Marco Antonio Nina Mena Date: Fri, 27 Oct 2017 15:33:53 -0400 Subject: [PATCH 69/85] fix CR --- .../engine/content/translations/english/processmaker.en.po | 4 ++-- workflow/engine/data/mysql/insert.sql | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/workflow/engine/content/translations/english/processmaker.en.po b/workflow/engine/content/translations/english/processmaker.en.po index 7a2549f48..78481270f 100644 --- a/workflow/engine/content/translations/english/processmaker.en.po +++ b/workflow/engine/content/translations/english/processmaker.en.po @@ -51762,5 +51762,5 @@ msgstr "versioning" # TRANSLATION # LABEL/ID_SELECT_VARIABLE #: LABEL/ID_SELECT_VARIABLE -msgid "Select Variable" -msgstr "Select Variable" +msgid "Select Variable " +msgstr "Select Variable " diff --git a/workflow/engine/data/mysql/insert.sql b/workflow/engine/data/mysql/insert.sql index 5987a4ce5..ee5ee14b9 100644 --- a/workflow/engine/data/mysql/insert.sql +++ b/workflow/engine/data/mysql/insert.sql @@ -6285,8 +6285,8 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_e6fe2cb291ace4c56d3f9481b3b963af','en','Select a language','2017-10-25') , ( 'LABEL','ID_MAFE_e9cb217697088a98b1937d111d936281','en','Attachment','2017-10-25') , ( 'LABEL','ID_MAFE_f1a76f66cca677c6e628d9ca58a6c8fc','en','Flow','2017-10-25') , -( 'LABEL','ID_MAFE_f775fa07e143b2e671946a48af8f42ca','en','versioning','2017-10-25') -( 'LABEL','ID_SELECT_VARIABLE','en','Select Variable','2017-10-27'); +( 'LABEL','ID_MAFE_f775fa07e143b2e671946a48af8f42ca','en','versioning','2017-10-25'), +( 'LABEL','ID_SELECT_VARIABLE','en','Select Variable ','2017-10-27'); INSERT INTO ISO_LOCATION (IC_UID,IL_UID,IL_NAME,IL_NORMAL_NAME,IS_UID) VALUES ('AD','','',' ','') , From 889cfaa8926971e33853453327c6a7a6e0da171f Mon Sep 17 00:00:00 2001 From: Marco Antonio Nina Mena Date: Fri, 27 Oct 2017 15:35:34 -0400 Subject: [PATCH 70/85] fix line --- .../engine/content/translations/english/processmaker.en.po | 5 +++-- workflow/engine/data/mysql/insert.sql | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/workflow/engine/content/translations/english/processmaker.en.po b/workflow/engine/content/translations/english/processmaker.en.po index 78481270f..e936731e6 100644 --- a/workflow/engine/content/translations/english/processmaker.en.po +++ b/workflow/engine/content/translations/english/processmaker.en.po @@ -51762,5 +51762,6 @@ msgstr "versioning" # TRANSLATION # LABEL/ID_SELECT_VARIABLE #: LABEL/ID_SELECT_VARIABLE -msgid "Select Variable " -msgstr "Select Variable " +msgid "Select Variable" +msgstr "Select Variable" + diff --git a/workflow/engine/data/mysql/insert.sql b/workflow/engine/data/mysql/insert.sql index ee5ee14b9..3c31b450e 100644 --- a/workflow/engine/data/mysql/insert.sql +++ b/workflow/engine/data/mysql/insert.sql @@ -6286,7 +6286,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_e9cb217697088a98b1937d111d936281','en','Attachment','2017-10-25') , ( 'LABEL','ID_MAFE_f1a76f66cca677c6e628d9ca58a6c8fc','en','Flow','2017-10-25') , ( 'LABEL','ID_MAFE_f775fa07e143b2e671946a48af8f42ca','en','versioning','2017-10-25'), -( 'LABEL','ID_SELECT_VARIABLE','en','Select Variable ','2017-10-27'); +( 'LABEL','ID_SELECT_VARIABLE','en','Select Variable','2017-10-27'); INSERT INTO ISO_LOCATION (IC_UID,IL_UID,IL_NAME,IL_NORMAL_NAME,IS_UID) VALUES ('AD','','',' ','') , From 2845b3739072c6bfbc0f180117609d88c5c09d36 Mon Sep 17 00:00:00 2001 From: Marco Antonio Nina Mena Date: Fri, 27 Oct 2017 15:53:58 -0400 Subject: [PATCH 71/85] code style --- .../engine/methods/cases/caseHistory_Ajax.php | 241 ++++++------- .../methods/cases/caseMessageHistory_Ajax.php | 325 +++++++++--------- 2 files changed, 261 insertions(+), 305 deletions(-) diff --git a/workflow/engine/methods/cases/caseHistory_Ajax.php b/workflow/engine/methods/cases/caseHistory_Ajax.php index 6b1f948f8..00e5a5771 100644 --- a/workflow/engine/methods/cases/caseHistory_Ajax.php +++ b/workflow/engine/methods/cases/caseHistory_Ajax.php @@ -1,146 +1,117 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - */ -$actionAjax = isset( $_REQUEST['actionAjax'] ) ? $_REQUEST['actionAjax'] : null; +use ProcessMaker\Util\DateTime; -if ($actionAjax == 'historyGridList_JXP') { +$actionAjax = isset($_REQUEST['actionAjax']) ? $_REQUEST['actionAjax'] : null; - global $G_PUBLISH; - $criteria = Cases::getTransferHistoryCriteria($_SESSION['APPLICATION']); +switch ($actionAjax) { + case 'historyGridList_JXP': + global $G_PUBLISH; + $criteria = Cases::getTransferHistoryCriteria($_SESSION['APPLICATION']); - $rs = GulliverBasePeer::doSelectRs($criteria); - $totalCount = $rs->getRecordCount(); + $dataSet = GulliverBasePeer::doSelectRs($criteria); + $totalCount = $dataSet->getRecordCount(); - $start = $_REQUEST["start"]; - $limit = $_REQUEST["limit"]; + $start = $_REQUEST['start']; + $limit = $_REQUEST['limit']; - $criteria->setLimit($limit); - $criteria->setOffset($start); + $criteria->setLimit($limit); + $criteria->setOffset($start); - $rs = GulliverBasePeer::doSelectRs($criteria); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $result = new stdClass(); - $aProcesses = Array(); - while ($rs->next()) { - $result = $rs->getRow(); - $result["ID_HISTORY"] = $result["PRO_UID"] . '_' . $result["APP_UID"] . '_' . $result["TAS_UID"]; - $aProcesses[] = $result; - } + $dataSet = GulliverBasePeer::doSelectRs($criteria); + $dataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $result = new stdClass(); + $process = []; + while ($dataSet->next()) { + $result = $dataSet->getRow(); + $result['ID_HISTORY'] = $result['PRO_UID'] . '_' . $result['APP_UID'] . '_' . $result['TAS_UID']; + $process[] = $result; + } - $r = new stdclass(); - $r->data = \ProcessMaker\Util\DateTime::convertUtcToTimeZone($aProcesses); - $r->totalCount = $totalCount; + $response = new stdclass(); + $response->data = DateTime::convertUtcToTimeZone($process); + $response->totalCount = $totalCount; - echo G::json_encode($r); + echo G::json_encode($response); + break; + case '': + //!dataInput + $idHistory = $_REQUEST['idHistory']; + + //!dataSytem + $idHistoryArray = explode('*', $idHistory); + $_REQUEST['PRO_UID'] = $idHistoryArray[0]; + $_REQUEST['APP_UID'] = $idHistoryArray[1]; + $_REQUEST['TAS_UID'] = $idHistoryArray[2]; + $_REQUEST['DYN_UID'] = ''; + + ?> + + + + + + + + +
+
+ AddContent('view', 'cases/cases_DynaformHistory'); + G::RenderPage('publish', 'raw'); + ?> +
+
+ + + + + + + + + + + + + + + + + + + +
  
  + +  
  
+
+ Load($idDin); + + $title = ''; + if ($row) { + $title = $row['DYN_TITLE']; + } + + //assign task + $result = new stdClass(); + $result->dynTitle = $title; + $result->md5Hash = G::encryptOld($idDin . $dynDate); + + echo G::json_encode($result); + break; + default: + break; } - -if ($actionAjax == 'historyGridListChangeLogPanelBody_JXP') { - //!dataInput - $idHistory = $_REQUEST["idHistory"]; - //!dataInput - - - //!dataSytem - $idHistoryArray = explode( "*", $idHistory ); - $_REQUEST["PRO_UID"] = $idHistoryArray[0]; - $_REQUEST["APP_UID"] = $idHistoryArray[1]; - $_REQUEST["TAS_UID"] = $idHistoryArray[2]; - $_REQUEST["DYN_UID"] = ""; - - ?> - - - - - - - - -
-
- AddContent( 'view', 'cases/cases_DynaformHistory' ); - G::RenderPage( 'publish', 'raw' ); - ?> -
-
- - - - - - - - - - - - - - - - - - - -
  
  - -  
  
-
- Load($idDin); - - if ($row) { - $dynTitle = $row['DYN_TITLE']; - } - - $md5Hash = G::encryptOld( $idDin . $dynDate ); - - //assign task - $result = new stdClass(); - $result->dynTitle = $dynTitle; - $result->md5Hash = $md5Hash; - - echo G::json_encode( $result ); - -} - diff --git a/workflow/engine/methods/cases/caseMessageHistory_Ajax.php b/workflow/engine/methods/cases/caseMessageHistory_Ajax.php index 25017017d..3efccecb4 100644 --- a/workflow/engine/methods/cases/caseMessageHistory_Ajax.php +++ b/workflow/engine/methods/cases/caseMessageHistory_Ajax.php @@ -1,26 +1,4 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - */ use ProcessMaker\Core\System; @@ -28,183 +6,190 @@ $filter = new InputFilter(); $_POST = $filter->xssFilterHard($_POST); $_REQUEST = $filter->xssFilterHard($_REQUEST); -$arrayToTranslation = array( - "TRIGGER" => G::LoadTranslation("ID_TRIGGER_DB"), - "DERIVATION" => G::LoadTranslation("ID_DERIVATION_DB") -); +$arrayToTranslation = [ + 'TRIGGER' => G::LoadTranslation('ID_TRIGGER_DB'), + 'DERIVATION' => G::LoadTranslation('ID_DERIVATION_DB') +]; -$actionAjax = isset( $_REQUEST['actionAjax'] ) ? $_REQUEST['actionAjax'] : null; +$actionAjax = isset($_REQUEST['actionAjax']) ? $_REQUEST['actionAjax'] : null; -if ($actionAjax == 'messageHistoryGridList_JXP') { - - if (!isset($_REQUEST['start']) || $_REQUEST['start'] =='') { - $_REQUEST['start'] = 0; - } - - if (!isset($_REQUEST['limit']) || $_REQUEST['limit'] =='') { - $_REQUEST['limit'] = 20; - } - - $dir = isset( $_POST['dir'] ) ? $_POST['dir'] : 'ASC'; - $sort = isset( $_POST['sort'] ) ? $_POST['sort'] : ''; - - global $G_PUBLISH; - $oCase = new Cases(); - $oCase->dir = $dir; - $oCase->sort = $sort; - - $appMessageArray = $oCase->getHistoryMessagesTrackerExt( $_SESSION['APPLICATION'], true, $_REQUEST['start'], $_REQUEST['limit']); - $appMessageCountArray = $oCase->getHistoryMessagesTrackerExt( $_SESSION['APPLICATION'], true); - $result = new stdClass(); - $aProcesses = Array (); - - - $proUid = $_SESSION['PROCESS']; - $appUid = $_SESSION['APPLICATION']; - $tasUid = $_SESSION['TASK']; - $usrUid = $_SESSION['USER_LOGGED']; - - $respBlock = $oCase->getAllObjectsFrom( $proUid, $appUid, $tasUid, $usrUid, 'BLOCK' ); - $respView = $oCase->getAllObjectsFrom( $proUid, $appUid, $tasUid, $usrUid, 'VIEW' ); - $respResend = $oCase->getAllObjectsFrom( $proUid, $appUid, $tasUid, $usrUid, 'RESEND' ); - - $delIndex = array(); - $respMess = ""; - - if (count($respBlock["MSGS_HISTORY"]) > 0) { - $respMess = $respBlock["MSGS_HISTORY"]["PERMISSION"]; - if (isset($respBlock["MSGS_HISTORY"]["DEL_INDEX"])) { - $delIndex = $respBlock["MSGS_HISTORY"]["DEL_INDEX"]; +switch ($actionAjax) { + case 'messageHistoryGridList_JXP': + if (!isset($_REQUEST['start']) || $_REQUEST['start'] == '') { + $_REQUEST['start'] = 0; } - } - if (count($respView["MSGS_HISTORY"]) > 0) { - $respMess = $respView["MSGS_HISTORY"]["PERMISSION"]; - if (isset($respView["MSGS_HISTORY"]["DEL_INDEX"])) { - $delIndex = $respView["MSGS_HISTORY"]["DEL_INDEX"]; + if (!isset($_REQUEST['limit']) || $_REQUEST['limit'] == '') { + $_REQUEST['limit'] = 20; } - } - if (count($respResend["MSGS_HISTORY"]) > 0) { - $respMess = $respResend["MSGS_HISTORY"]["PERMISSION"]; - if (isset($respResend["MSGS_HISTORY"]["DEL_INDEX"])) { - $delIndex = $respResend["MSGS_HISTORY"]["DEL_INDEX"]; - } - } + $dir = isset($_POST['dir']) ? $_POST['dir'] : 'ASC'; + $sort = isset($_POST['sort']) ? $_POST['sort'] : ''; - $totalCount = 0; - foreach ($appMessageArray as $index => $value) { - if (($appMessageArray[$index]['APP_MSG_SHOW_MESSAGE'] == 1 && $respMess != 'BLOCK' ) && - ($appMessageArray[$index]['DEL_INDEX'] == 0 || in_array($appMessageArray[$index]['DEL_INDEX'], $delIndex ))) { + global $G_PUBLISH; + $case = new Cases(); + $case->dir = $dir; + $case->sort = $sort; - $appMessageArray[$index]['ID_MESSAGE'] = $appMessageArray[$index]['APP_UID'] . '_' . $appMessageArray[$index]['APP_MSG_UID']; - if ($respMess == 'BLOCK' || $respMess == '') { - $appMessageArray[$index]['APP_MSG_BODY'] = ""; + $appMessageArray = $case->getHistoryMessagesTrackerExt($_SESSION['APPLICATION'], true, $_REQUEST['start'], $_REQUEST['limit']); + $appMessageCountArray = $case->getHistoryMessagesTrackerExt($_SESSION['APPLICATION'], true); + $result = new stdClass(); + $aProcesses = array(); + + + $proUid = $_SESSION['PROCESS']; + $appUid = $_SESSION['APPLICATION']; + $tasUid = $_SESSION['TASK']; + $usrUid = $_SESSION['USER_LOGGED']; + + $respBlock = $case->getAllObjectsFrom($proUid, $appUid, $tasUid, $usrUid, 'BLOCK'); + $respView = $case->getAllObjectsFrom($proUid, $appUid, $tasUid, $usrUid, 'VIEW'); + $respResend = $case->getAllObjectsFrom($proUid, $appUid, $tasUid, $usrUid, 'RESEND'); + + $delIndex = []; + $respMess = ''; + + if (count($respBlock['MSGS_HISTORY']) > 0) { + $respMess = $respBlock['MSGS_HISTORY']['PERMISSION']; + if (isset($respBlock['MSGS_HISTORY']['DEL_INDEX'])) { + $delIndex = $respBlock['MSGS_HISTORY']['DEL_INDEX']; } - $aProcesses[] = array_merge($appMessageArray[$index], array('MSGS_HISTORY' => $respMess)); - $totalCount ++; - } - } - - $aProcesses = array_splice($aProcesses, $_REQUEST['start'], $_REQUEST['limit']); - - $r = new stdclass(); - $r->data = $aProcesses; - $r->totalCount = $totalCount; - - if (!empty($aProcesses)) { - if (!isset($r->data[0])) { - $r->data[0] = array('APP_MSG_TYPE' => ''); } - foreach ($r->data as $key => $value) { - $r->data[$key]["APP_MSG_TYPE"] = array_key_exists($r->data[$key]["APP_MSG_TYPE"], $arrayToTranslation) ? - $arrayToTranslation[$r->data[$key]["APP_MSG_TYPE"]] : - $r->data[$key]["APP_MSG_TYPE"]; + if (count($respView['MSGS_HISTORY']) > 0) { + $respMess = $respView['MSGS_HISTORY']['PERMISSION']; + if (isset($respView['MSGS_HISTORY']['DEL_INDEX'])) { + $delIndex = $respView['MSGS_HISTORY']['DEL_INDEX']; + } } - } - echo G::json_encode( $r ); -} -if ($actionAjax == 'showHistoryMessage') { - - ?> - - - - $value) { + if (($appMessageArray[$index]['APP_MSG_SHOW_MESSAGE'] === 1 && $respMess !== 'BLOCK') && + ($appMessageArray[$index]['DEL_INDEX'] === 0 || in_array($appMessageArray[$index]['DEL_INDEX'], $delIndex))) { + $appMessageArray[$index]['ID_MESSAGE'] = $appMessageArray[$index]['APP_UID'] . '_' . $appMessageArray[$index]['APP_MSG_UID']; + if ($respMess === 'BLOCK' || $respMess === '') { + $appMessageArray[$index]['APP_MSG_BODY'] = ''; + } + $aProcesses[] = array_merge($appMessageArray[$index], ['MSGS_HISTORY' => $respMess]); + $totalCount++; + } + } - $_POST["APP_UID"] = $_REQUEST["APP_UID"]; - $_POST['APP_MSG_UID'] = $_REQUEST["APP_MSG_UID"]; + $aProcesses = array_splice($aProcesses, $_REQUEST['start'], $_REQUEST['limit']); - $G_PUBLISH = new Publisher(); - $oCase = new Cases(); + $response = new stdclass(); + $response->data = $aProcesses; + $response->totalCount = $totalCount; - $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_MessagesView', '', $oCase->getHistoryMessagesTrackerView( $_POST['APP_UID'], $_POST['APP_MSG_UID'] ) ); + if (!empty($aProcesses)) { + if (!isset($response->data[0])) { + $response->data[0] = array('APP_MSG_TYPE' => ''); + } - ?> - - getHistoryMessagesTrackerView( $_POST['APP_UID'], $_POST['APP_MSG_UID'] ); + $G_PUBLISH->AddContent('xmlform', 'xmlform', 'cases/cases_MessagesView', '', $case->getHistoryMessagesTrackerView($_POST['APP_UID'], $_POST['APP_MSG_UID'])); + ?> + + getHistoryMessagesTrackerView($_POST['APP_UID'], $_POST['APP_MSG_UID']); - $oSpool->setConfig($aSetup); - $oSpool->create( array ('msg_uid' => $data['MSG_UID'],'app_uid' => $data['APP_UID'],'del_index' => $data['DEL_INDEX'],'app_msg_type' => $data['APP_MSG_TYPE'],'app_msg_subject' => $data['APP_MSG_SUBJECT'],'app_msg_from' => $data['APP_MSG_FROM'],'app_msg_to' => $data['APP_MSG_TO'],'app_msg_body' => $data['APP_MSG_BODY'],'app_msg_cc' => $data['APP_MSG_CC'],'app_msg_bcc' => $data['APP_MSG_BCC'],'app_msg_attach' => $data['APP_MSG_ATTACH'],'app_msg_template' => $data['APP_MSG_TEMPLATE'],'app_msg_status' => 'pending' - ) ); - $oSpool->sendMail(); + $spool = new SpoolRun(); - } catch (Exception $e) { - - $errorMessage = $e->getMessage(); - } - - echo $errorMessage; + $spool->setConfig(System::getEmailConfiguration()); + $spool->create([ + 'msg_uid' => $data['MSG_UID'], + 'app_uid' => $data['APP_UID'], + 'del_index' => $data['DEL_INDEX'], + 'app_msg_type' => $data['APP_MSG_TYPE'], + 'app_msg_subject' => $data['APP_MSG_SUBJECT'], + 'app_msg_from' => $data['APP_MSG_FROM'], + 'app_msg_to' => $data['APP_MSG_TO'], + 'app_msg_body' => $data['APP_MSG_BODY'], + 'app_msg_cc' => $data['APP_MSG_CC'], + 'app_msg_bcc' => $data['APP_MSG_BCC'], + 'app_msg_attach' => $data['APP_MSG_ATTACH'], + 'app_msg_template' => $data['APP_MSG_TEMPLATE'], + 'app_msg_status' => 'pending' + ]); + $spool->sendMail(); + } catch (Exception $error) { + $message = $error->getMessage(); + } + echo $message; + break; + default: + break; } - From 418f479d5198cd5fe600a940111469adec8e7c9a Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Fri, 27 Oct 2017 16:22:07 -0400 Subject: [PATCH 72/85] HOR-3622 --- .../BusinessModel/FilesManager.php | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/FilesManager.php b/workflow/engine/src/ProcessMaker/BusinessModel/FilesManager.php index 1d8ad5880..1da6ec877 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/FilesManager.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/FilesManager.php @@ -2,6 +2,10 @@ namespace ProcessMaker\BusinessModel; use \G; +use Criteria; +use ProcessFilesPeer; +use ProcessPeer; +use TaskPeer; class FilesManager { @@ -397,26 +401,27 @@ class FilesManager * * @param string $path * @param string $fileName the name of template + * @throws Exception * - * return array + * @return array */ public function getFileManagerUid($path, $fileName = '') { try { if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { - $path = str_replace("/", DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR, $path); + $path = str_replace("/", DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR, $path); } - $path = explode(DIRECTORY_SEPARATOR,$path); - $baseName = $path[count($path)-2]."\\\\".$path[count($path)-1]; - $baseName2 = $path[count($path)-2]."/".$path[count($path)-1]; - $criteria = new \Criteria("workflow"); - $criteria->addSelectColumn(\ProcessFilesPeer::PRF_UID); - $criteria->addSelectColumn(\ProcessPeer::PRO_DERIVATION_SCREEN_TPL); - $criteria->addSelectColumn(\TaskPeer::TAS_DERIVATION_SCREEN_TPL); - $criteria->addJoin(\ProcessFilesPeer::PRO_UID, \ProcessPeer::PRO_UID); - $criteria->addJoin(\ProcessPeer::PRO_UID, \TaskPeer::PRO_UID); - $criteria->add( $criteria->getNewCriterion( \ProcessFilesPeer::PRF_PATH, '%' . $baseName . '%', \Criteria::LIKE )->addOr( $criteria->getNewCriterion( \ProcessFilesPeer::PRF_PATH, '%' . $baseName2 . '%', \Criteria::LIKE ))); - $rsCriteria = \ProcessFilesPeer::doSelectRS($criteria); + $path = explode(DIRECTORY_SEPARATOR, $path); + $baseName = $path[count($path) - 2] . "\\\\" . $path[count($path) - 1]; + $baseName2 = $path[count($path) - 2] . "/" . $path[count($path) - 1]; + $criteria = new Criteria("workflow"); + $criteria->addSelectColumn(ProcessFilesPeer::PRF_UID); + $criteria->addSelectColumn(ProcessPeer::PRO_DERIVATION_SCREEN_TPL); + $criteria->addSelectColumn(TaskPeer::TAS_DERIVATION_SCREEN_TPL); + $criteria->addJoin(ProcessFilesPeer::PRO_UID, ProcessPeer::PRO_UID); + $criteria->addJoin(ProcessPeer::PRO_UID, TaskPeer::PRO_UID, Criteria::LEFT_JOIN); + $criteria->add($criteria->getNewCriterion(ProcessFilesPeer::PRF_PATH, '%' . $baseName . '%', Criteria::LIKE)->addOr($criteria->getNewCriterion(ProcessFilesPeer::PRF_PATH, '%' . $baseName2 . '%', Criteria::LIKE))); + $rsCriteria = ProcessFilesPeer::doSelectRS($criteria); $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); $row = array(); while ($rsCriteria->next()) { @@ -430,7 +435,7 @@ class FilesManager } } return $row; - } catch (\Exception $e) { + } catch (Exception $e) { throw $e; } } From eb323992b4f86dfcd788da70be3d0ceca8990714 Mon Sep 17 00:00:00 2001 From: Marco Antonio Nina Mena Date: Mon, 30 Oct 2017 12:09:39 -0400 Subject: [PATCH 73/85] fix CR --- workflow/engine/methods/cases/caseHistory_Ajax.php | 2 -- .../methods/cases/caseMessageHistory_Ajax.php | 14 ++++++-------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/workflow/engine/methods/cases/caseHistory_Ajax.php b/workflow/engine/methods/cases/caseHistory_Ajax.php index 00e5a5771..e3fc9d007 100644 --- a/workflow/engine/methods/cases/caseHistory_Ajax.php +++ b/workflow/engine/methods/cases/caseHistory_Ajax.php @@ -112,6 +112,4 @@ switch ($actionAjax) { echo G::json_encode($result); break; - default: - break; } diff --git a/workflow/engine/methods/cases/caseMessageHistory_Ajax.php b/workflow/engine/methods/cases/caseMessageHistory_Ajax.php index 3efccecb4..cd7059952 100644 --- a/workflow/engine/methods/cases/caseMessageHistory_Ajax.php +++ b/workflow/engine/methods/cases/caseMessageHistory_Ajax.php @@ -34,7 +34,7 @@ switch ($actionAjax) { $appMessageArray = $case->getHistoryMessagesTrackerExt($_SESSION['APPLICATION'], true, $_REQUEST['start'], $_REQUEST['limit']); $appMessageCountArray = $case->getHistoryMessagesTrackerExt($_SESSION['APPLICATION'], true); $result = new stdClass(); - $aProcesses = array(); + $process = []; $proUid = $_SESSION['PROCESS']; @@ -78,18 +78,18 @@ switch ($actionAjax) { if ($respMess === 'BLOCK' || $respMess === '') { $appMessageArray[$index]['APP_MSG_BODY'] = ''; } - $aProcesses[] = array_merge($appMessageArray[$index], ['MSGS_HISTORY' => $respMess]); + $process[] = array_merge($appMessageArray[$index], ['MSGS_HISTORY' => $respMess]); $totalCount++; } } - $aProcesses = array_splice($aProcesses, $_REQUEST['start'], $_REQUEST['limit']); + $process = array_splice($process, $_REQUEST['start'], $_REQUEST['limit']); $response = new stdclass(); - $response->data = $aProcesses; + $response->data = $process; $response->totalCount = $totalCount; - if (!empty($aProcesses)) { + if (!empty($process)) { if (!isset($response->data[0])) { $response->data[0] = array('APP_MSG_TYPE' => ''); } @@ -147,7 +147,7 @@ switch ($actionAjax) { Date: Mon, 30 Oct 2017 13:10:37 -0400 Subject: [PATCH 74/85] HOR-4012 Verify type columns in table PLUGINS_REGISTRY - change type field to mediumtext - set table collation utf8_general_ci --- .../model/map/PluginsRegistryMapBuilder.php | 2 +- .../classes/model/om/BasePluginsRegistry.php | 4 ++-- workflow/engine/config/schema.xml | 24 ++++++++++++++++++- workflow/engine/data/mysql/schema.sql | 2 +- 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/workflow/engine/classes/model/map/PluginsRegistryMapBuilder.php b/workflow/engine/classes/model/map/PluginsRegistryMapBuilder.php index 25cfaf8c6..42470e305 100644 --- a/workflow/engine/classes/model/map/PluginsRegistryMapBuilder.php +++ b/workflow/engine/classes/model/map/PluginsRegistryMapBuilder.php @@ -69,7 +69,7 @@ class PluginsRegistryMapBuilder $tMap->addColumn('PLUGIN_NAMESPACE', 'PluginNamespace', 'string', CreoleTypes::VARCHAR, true, 100); - $tMap->addColumn('PLUGIN_DESCRIPTION', 'PluginDescription', 'string', CreoleTypes::VARCHAR, false, 200); + $tMap->addColumn('PLUGIN_DESCRIPTION', 'PluginDescription', 'string', CreoleTypes::LONGVARCHAR, false, null); $tMap->addColumn('PLUGIN_CLASS_NAME', 'PluginClassName', 'string', CreoleTypes::VARCHAR, true, 100); diff --git a/workflow/engine/classes/model/om/BasePluginsRegistry.php b/workflow/engine/classes/model/om/BasePluginsRegistry.php index d6f0be021..a3e4d77b8 100644 --- a/workflow/engine/classes/model/om/BasePluginsRegistry.php +++ b/workflow/engine/classes/model/om/BasePluginsRegistry.php @@ -43,7 +43,7 @@ abstract class BasePluginsRegistry extends BaseObject implements Persistent * The value for the plugin_description field. * @var string */ - protected $plugin_description = ''; + protected $plugin_description; /** * The value for the plugin_class_name field. @@ -508,7 +508,7 @@ abstract class BasePluginsRegistry extends BaseObject implements Persistent $v = (string) $v; } - if ($this->plugin_description !== $v || $v === '') { + if ($this->plugin_description !== $v) { $this->plugin_description = $v; $this->modifiedColumns[] = PluginsRegistryPeer::PLUGIN_DESCRIPTION; } diff --git a/workflow/engine/config/schema.xml b/workflow/engine/config/schema.xml index 276ccb68d..6fa41d930 100644 --- a/workflow/engine/config/schema.xml +++ b/workflow/engine/config/schema.xml @@ -5649,10 +5649,32 @@ + + + + + + + + + + + + + - + + + + + + + + + + diff --git a/workflow/engine/data/mysql/schema.sql b/workflow/engine/data/mysql/schema.sql index 0f75d38d0..0d2aeb48c 100644 --- a/workflow/engine/data/mysql/schema.sql +++ b/workflow/engine/data/mysql/schema.sql @@ -3157,7 +3157,7 @@ CREATE TABLE `PLUGINS_REGISTRY` ( `PR_UID` VARCHAR(32) default '' NOT NULL, `PLUGIN_NAMESPACE` VARCHAR(100) NOT NULL, - `PLUGIN_DESCRIPTION` VARCHAR(200) default '', + `PLUGIN_DESCRIPTION` MEDIUMTEXT, `PLUGIN_CLASS_NAME` VARCHAR(100) NOT NULL, `PLUGIN_FRIENDLY_NAME` VARCHAR(150) default '', `PLUGIN_FILE` VARCHAR(250) NOT NULL, From d9586a1eb6153576fb068db6052b55ba69efc5f5 Mon Sep 17 00:00:00 2001 From: Marco Antonio Nina Mena Date: Mon, 30 Oct 2017 13:13:57 -0400 Subject: [PATCH 75/85] code style --- workflow/engine/config/schema.xml | 9812 +++++++++++++++-------------- 1 file changed, 4924 insertions(+), 4888 deletions(-) diff --git a/workflow/engine/config/schema.xml b/workflow/engine/config/schema.xml index 6fa41d930..376a4143e 100644 --- a/workflow/engine/config/schema.xml +++ b/workflow/engine/config/schema.xml @@ -1,2957 +1,2987 @@ -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
- - - - - - + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ - - - - - - + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + +
+ - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
- - - - - - - - - - - - - - - - - +
+ + + + + + + + + + + + + + + + - - - -
+ + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
- - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - + - - - - - + + + + + - + - + - + - +
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
- - - - - - - - - - - - - - - - - - -
+ + + + + + + + + + + + + + + + + + +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
- - - - - - - - - - - - - - - - - - - - - - - - - - -
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
- + - + - + @@ -4107,92 +4140,92 @@
- +
- - - - - + + + + +
- - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + +
- - - - - - - - - - + + + + + + + + + +
- - - - - - - - - - + + + + + + + + + + - - - - - - + + + + + +
- - - - - - - - - - + + + + + + + + + + - - + + @@ -4237,20 +4270,20 @@ - + - - - - - - - + + + + + + + @@ -4475,13 +4508,13 @@ - - - - - - - + + + + + + +
@@ -4739,7 +4772,7 @@ - + @@ -4748,565 +4781,565 @@
- - - - - - - - - - + + + + + + + + + + - - - + + +
- - - - - - - - - - + + + + + + + + + + - - - - + + + +
- - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + +
- - - - - - - - - - + + + + + + + + + + - + - - - - - - - - + + + + + + + + - +
- - - - - - - - - - + + + + + + + + + + - - - - - - - + + + + + + +
- - - - - - - - - - + + + + + + + + + + - - - - + + + +
- - - - - - - - - - + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - +
- - - - - - - - - - + + + + + + + + + + - - - + + + - +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + @@ -5330,84 +5363,84 @@
- - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + +
- - - - - - - - - - + + + + + + + + + + - - - - - - + + + + + +
- - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + @@ -5433,21 +5466,21 @@
- - - - - - - - - - + + + + + + + + + + - - - + + + @@ -5456,25 +5489,25 @@
- - - - - - - - - - + + + + + + + + + + - - - - - - - + + + + + + + @@ -5496,206 +5529,209 @@
- - - - - - - - - - + + + + + + + + + + - - - - - + + + + + - +
- - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + - +
- - - - - - - - - - + + + + + + + + + + - + - - - + + + - - + +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
- - - - - - - - - - - + + + + + + + + + + + - + - - - - - + + + + +
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
From 5772d5da917cb9188a121a6fd159a539b96aa7da Mon Sep 17 00:00:00 2001 From: Marco Antonio Nina Mena Date: Mon, 30 Oct 2017 15:17:48 -0400 Subject: [PATCH 76/85] Fix CR --- workflow/engine/config/schema.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow/engine/config/schema.xml b/workflow/engine/config/schema.xml index 376a4143e..455c759ce 100644 --- a/workflow/engine/config/schema.xml +++ b/workflow/engine/config/schema.xml @@ -5696,7 +5696,7 @@ - + From 7818ee7b36efd1e9554bd0990ef2a29eeacb920d Mon Sep 17 00:00:00 2001 From: dante Date: Tue, 24 Oct 2017 14:48:52 -0400 Subject: [PATCH 77/85] HOR-3954 --- workflow/engine/classes/Cases.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/workflow/engine/classes/Cases.php b/workflow/engine/classes/Cases.php index 9eccb3e89..0a25014d6 100644 --- a/workflow/engine/classes/Cases.php +++ b/workflow/engine/classes/Cases.php @@ -4321,8 +4321,8 @@ class Cases unset($rowListCanceled['DEL_CURRENT_USR_FIRSTNAME']); unset($rowListCanceled['DEL_CURRENT_USR_LASTNAME']); unset($rowListCanceled['APP_CANCELED_DATE']); - $listInbox = new ListInbox(); - $listInbox->create($rowListCanceled); + + $this->putCaseInInboxList($rowListCanceled, $userUID); //ListParticipatedLast $criteriaListParticipatedLast = new Criteria("workflow"); @@ -7267,5 +7267,18 @@ class Cases } return false; } + + /** + * Inserts int the ListInbox of the user $targetUserId case whose data is in the variable $caseDataRow + * @param array $caseDataRow, assoc. array with the data of the case + * @param int $targetUserId, id of the user that will have the case. + * @return void + */ + private function putCaseInInboxList($caseDataRow, $targetUserId) + { + $listInbox = new ListInbox(); + $caseDataRow["USR_UID"] = $targetUserId; + $listInbox->create($caseDataRow); + } } From 055a6d5c1951d17517745c31734156915fffbf9a Mon Sep 17 00:00:00 2001 From: Marco Antonio Nina Mena Date: Tue, 31 Oct 2017 08:08:22 -0400 Subject: [PATCH 78/85] reverse change of triple equality --- workflow/engine/methods/cases/caseMessageHistory_Ajax.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/workflow/engine/methods/cases/caseMessageHistory_Ajax.php b/workflow/engine/methods/cases/caseMessageHistory_Ajax.php index cd7059952..8ed713a92 100644 --- a/workflow/engine/methods/cases/caseMessageHistory_Ajax.php +++ b/workflow/engine/methods/cases/caseMessageHistory_Ajax.php @@ -72,10 +72,10 @@ switch ($actionAjax) { $totalCount = 0; foreach ($appMessageArray as $index => $value) { - if (($appMessageArray[$index]['APP_MSG_SHOW_MESSAGE'] === 1 && $respMess !== 'BLOCK') && - ($appMessageArray[$index]['DEL_INDEX'] === 0 || in_array($appMessageArray[$index]['DEL_INDEX'], $delIndex))) { + if (($appMessageArray[$index]['APP_MSG_SHOW_MESSAGE'] == 1 && $respMess != 'BLOCK') && + ($appMessageArray[$index]['DEL_INDEX'] == 0 || in_array($appMessageArray[$index]['DEL_INDEX'], $delIndex))) { $appMessageArray[$index]['ID_MESSAGE'] = $appMessageArray[$index]['APP_UID'] . '_' . $appMessageArray[$index]['APP_MSG_UID']; - if ($respMess === 'BLOCK' || $respMess === '') { + if ($respMess == 'BLOCK' || $respMess == '') { $appMessageArray[$index]['APP_MSG_BODY'] = ''; } $process[] = array_merge($appMessageArray[$index], ['MSGS_HISTORY' => $respMess]); From 99300c9178806c8e413ce32b85018be59cd7d85a Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Tue, 31 Oct 2017 08:33:47 -0400 Subject: [PATCH 79/85] HOR-4010 --- workflow/public_html/sysGeneric.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/workflow/public_html/sysGeneric.php b/workflow/public_html/sysGeneric.php index c41e759b3..65ad6ba90 100644 --- a/workflow/public_html/sysGeneric.php +++ b/workflow/public_html/sysGeneric.php @@ -519,6 +519,12 @@ $oHeadPublisher = & headPublisher::getSingleton(); if (! defined( 'PATH_DATA' ) || ! file_exists( PATH_DATA )) { // new installer, extjs based define( 'PATH_DATA', PATH_C ); + + //important to start laravel classes + app()->useStoragePath(realpath(PATH_DATA)); + app()->make(Kernel::class)->bootstrap(); + restore_error_handler(); + //NewRelic Snippet - By JHL transactionLog(PATH_CONTROLLERS.'installer.php'); $pathFile = PATH_CONTROLLERS . 'installer.php'; From 87a09f90fe1f4c851b46d06f75f257c1fd53d27b Mon Sep 17 00:00:00 2001 From: dante Date: Tue, 31 Oct 2017 10:01:30 -0400 Subject: [PATCH 80/85] Fixing CR observations --- workflow/engine/classes/Cases.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/workflow/engine/classes/Cases.php b/workflow/engine/classes/Cases.php index 0a25014d6..874871cf3 100644 --- a/workflow/engine/classes/Cases.php +++ b/workflow/engine/classes/Cases.php @@ -7270,11 +7270,13 @@ class Cases /** * Inserts int the ListInbox of the user $targetUserId case whose data is in the variable $caseDataRow + * * @param array $caseDataRow, assoc. array with the data of the case * @param int $targetUserId, id of the user that will have the case. + * * @return void */ - private function putCaseInInboxList($caseDataRow, $targetUserId) + private function putCaseInInboxList(array $caseDataRow, $targetUserId) { $listInbox = new ListInbox(); $caseDataRow["USR_UID"] = $targetUserId; From 6963afe9ae5a4cfcde545eaa11e4080af3a5db07 Mon Sep 17 00:00:00 2001 From: dante Date: Tue, 31 Oct 2017 15:39:11 -0400 Subject: [PATCH 81/85] HOR-3990 --- workflow/engine/src/ProcessMaker/BusinessModel/EmailEvent.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/EmailEvent.php b/workflow/engine/src/ProcessMaker/BusinessModel/EmailEvent.php index 9992308b0..073c95028 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/EmailEvent.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/EmailEvent.php @@ -472,7 +472,8 @@ class EmailEvent if (!empty($emailTo)) { $subject = $arrayData[5]; $subject = \G::replaceDataField($arrayData[5], $arrayApplicationData['APP_DATA']); - \PMFSendMessage($appUID, $configEmailData['MESS_ACCOUNT'], $emailTo, '', '', $subject, + $emailFrom = ($configEmailData["MESS_FROM_NAME"] . ' <' . $configEmailData["MESS_FROM_MAIL"] . '>'); + \PMFSendMessage($appUID, $emailFrom, $emailTo, '', '', $subject, $contentFile['prf_filename'], array(), array(), true, 0, $configEmailData); } else { \Bootstrap::registerMonolog('EmailEventMailError', 200, \G::LoadTranslation('ID_EMAIL_EVENT_CONFIGURATION_EMAIL', array($eventUid, $prj_uid)), ['eventUid' => $eventUid, 'prj_uid' => $prj_uid], config("system.workspace"), 'processmaker.log'); From 130ceff5e0c6c8f2dccbbe9b29a10c4477dba9fb Mon Sep 17 00:00:00 2001 From: dante Date: Tue, 31 Oct 2017 16:41:35 -0400 Subject: [PATCH 82/85] Use of G::buildFrom function --- workflow/engine/src/ProcessMaker/BusinessModel/EmailEvent.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/EmailEvent.php b/workflow/engine/src/ProcessMaker/BusinessModel/EmailEvent.php index 073c95028..acc79fd41 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/EmailEvent.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/EmailEvent.php @@ -472,7 +472,7 @@ class EmailEvent if (!empty($emailTo)) { $subject = $arrayData[5]; $subject = \G::replaceDataField($arrayData[5], $arrayApplicationData['APP_DATA']); - $emailFrom = ($configEmailData["MESS_FROM_NAME"] . ' <' . $configEmailData["MESS_FROM_MAIL"] . '>'); + $emailFrom = \G::buildFrom($configEmailData); \PMFSendMessage($appUID, $emailFrom, $emailTo, '', '', $subject, $contentFile['prf_filename'], array(), array(), true, 0, $configEmailData); } else { From eacd4e51ae52adb31602abda474cbf4302d49db0 Mon Sep 17 00:00:00 2001 From: dante Date: Tue, 31 Oct 2017 16:43:49 -0400 Subject: [PATCH 83/85] Fix CR observations --- workflow/engine/src/ProcessMaker/BusinessModel/EmailEvent.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/EmailEvent.php b/workflow/engine/src/ProcessMaker/BusinessModel/EmailEvent.php index acc79fd41..c105b6c85 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/EmailEvent.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/EmailEvent.php @@ -472,8 +472,7 @@ class EmailEvent if (!empty($emailTo)) { $subject = $arrayData[5]; $subject = \G::replaceDataField($arrayData[5], $arrayApplicationData['APP_DATA']); - $emailFrom = \G::buildFrom($configEmailData); - \PMFSendMessage($appUID, $emailFrom, $emailTo, '', '', $subject, + \PMFSendMessage($appUID, \G::buildFrom($configEmailData), $emailTo, '', '', $subject, $contentFile['prf_filename'], array(), array(), true, 0, $configEmailData); } else { \Bootstrap::registerMonolog('EmailEventMailError', 200, \G::LoadTranslation('ID_EMAIL_EVENT_CONFIGURATION_EMAIL', array($eventUid, $prj_uid)), ['eventUid' => $eventUid, 'prj_uid' => $prj_uid], config("system.workspace"), 'processmaker.log'); From 08e506dabe2a2e5cc82c1bda3633c1fc924fa852 Mon Sep 17 00:00:00 2001 From: davidcallizaya Date: Wed, 1 Nov 2017 07:51:17 -0400 Subject: [PATCH 84/85] HOR-3949 EP: {{url}}/api/1.0/{{workspace}}/light/get-next-step/{{app_uid}} Return the array value for an input file control. --- .../src/ProcessMaker/BusinessModel/Cases.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php b/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php index 3beb9067b..1cbf3c793 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php @@ -1696,7 +1696,7 @@ class Cases } foreach ($appData as $key => $val) { if (in_array($key, $field, true) != false) { - $caseVariable[$key] = $appData[$key]; + $caseVariable[$key] = $this->getFieldValue($field, $appData[$key]); if (isset($appData[$key . '_label'])) { $caseVariable[$key . '_label'] = $appData[$key . '_label']; } @@ -1717,6 +1717,23 @@ class Cases } } + /** + * Return the field value to be used in the front-end client. + * + * @param type $field + * @param type $value + * @return type + */ + private function getFieldValue($field, $value) + { + switch ($field['type']) { + case 'file': + return $field['data']['app_doc_uid']; + default: + return $value; + } + } + /** * Get Case Variables * From 655ec4ee00afca15a664bc008c7b236704cac0aa Mon Sep 17 00:00:00 2001 From: dante Date: Wed, 1 Nov 2017 09:01:23 -0400 Subject: [PATCH 85/85] Using namespace for call to G functions --- .../src/ProcessMaker/BusinessModel/EmailEvent.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/EmailEvent.php b/workflow/engine/src/ProcessMaker/BusinessModel/EmailEvent.php index c105b6c85..83645136d 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/EmailEvent.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/EmailEvent.php @@ -1,6 +1,8 @@ existsEvent($prj_uid, $evn_uid)) { - throw new \Exception(\G::LoadTranslation("ID_EMAIL_EVENT_DEFINITION_DOES_NOT_EXIST")); + throw new \Exception(G::LoadTranslation("ID_EMAIL_EVENT_DEFINITION_DOES_NOT_EXIST")); } $arrayData = $this->existsEvent($prj_uid, $evn_uid); $this->delete($prj_uid, $arrayData[0]); @@ -387,7 +389,7 @@ class EmailEvent public function verifyIfEmailEventExists($emailEventUid) { if (!$this->exists($emailEventUid)) { - throw new \Exception(\G::LoadTranslation("ID_EMAIL_EVENT_DEFINITION_DOES_NOT_EXIST", array("Email Event Uid", $emailEventUid))); + throw new \Exception(G::LoadTranslation("ID_EMAIL_EVENT_DEFINITION_DOES_NOT_EXIST", array("Email Event Uid", $emailEventUid))); } } @@ -430,7 +432,7 @@ class EmailEvent public function sendEmail($appUID, $prj_uid, $eventUid, $arrayApplicationData) { if (!$this->existsEvent($prj_uid, $eventUid)) { - throw new \Exception(\G::LoadTranslation("ID_EMAIL_EVENT_DEFINITION_DOES_NOT_EXIST")); + throw new \Exception(G::LoadTranslation("ID_EMAIL_EVENT_DEFINITION_DOES_NOT_EXIST")); } $arrayData = $this->existsEvent($prj_uid, $eventUid); if (sizeof($arrayData)) { @@ -471,11 +473,11 @@ class EmailEvent } if (!empty($emailTo)) { $subject = $arrayData[5]; - $subject = \G::replaceDataField($arrayData[5], $arrayApplicationData['APP_DATA']); - \PMFSendMessage($appUID, \G::buildFrom($configEmailData), $emailTo, '', '', $subject, + $subject = G::replaceDataField($arrayData[5], $arrayApplicationData['APP_DATA']); + PMFSendMessage($appUID, G::buildFrom($configEmailData), $emailTo, '', '', $subject, $contentFile['prf_filename'], array(), array(), true, 0, $configEmailData); } else { - \Bootstrap::registerMonolog('EmailEventMailError', 200, \G::LoadTranslation('ID_EMAIL_EVENT_CONFIGURATION_EMAIL', array($eventUid, $prj_uid)), ['eventUid' => $eventUid, 'prj_uid' => $prj_uid], config("system.workspace"), 'processmaker.log'); + \Bootstrap::registerMonolog('EmailEventMailError', 200, G::LoadTranslation('ID_EMAIL_EVENT_CONFIGURATION_EMAIL', array($eventUid, $prj_uid)), ['eventUid' => $eventUid, 'prj_uid' => $prj_uid], config("system.workspace"), 'processmaker.log'); } } }