diff --git a/build.php b/build.php deleted file mode 100644 index 2932cfb64..000000000 --- a/build.php +++ /dev/null @@ -1,37 +0,0 @@ - Appearance & Behavior -> Keymap, search for ProcessMaker, open the context - * menu of the option and select Add Keyboard Shortcut, use whatever shortcut you want, for example Alt+b - * - * If you need help: php build.php --help - * - */ -include_once('class.Build.php'); -use Build\Utils\ProcessMakerPhpBuilderHelper; - -$phpBuilder = new ProcessMakerPhpBuilderHelper(); -$phpBuilder->utils->echoContent("Config finished, start deploying..."); -$phpBuilder->buildAll(); diff --git a/class.Build.php b/class.Build.php deleted file mode 100644 index ae16e6f58..000000000 --- a/class.Build.php +++ /dev/null @@ -1,1490 +0,0 @@ -utils = new PhpBuilderUtils(); - $this->versions = new Versions(); - $this->parameters = $this->getConfig(false); - - return $this->parameters; - } - - /** - * Get Function of class key - * @param string $key - * @return $value - */ - public function __get($key) - { - return $this->$key; - } - - /** - * Set Function of class key - * @param string $key - * @param string $value - * - */ - public function __set($key, $value) - { - $this->$key = $value; - } - - /** - * Get Config and configure Class variables from Arguments - * @param $clean - * @return array - */ - public function getConfig($clean) - { - $config = $this->utils->readArguments(); - // Show Help - if (isset($config['help'])) { - $this->utils->exitCode(4); - } - $baseDir = "./"; - if (defined('PATH_TRUNK')) { - $baseDir = PATH_TRUNK; - $this->utils->silentMode = true; - } - $this->baseDir = empty($config['base_dir']) ? $baseDir : $config['base_dir']; - $this->publicDir = $this->baseDir . "/workflow/public_html"; - $this->buildTempDir = $this->baseDir . "/shared/buildTemp"; - $this->logDir = $this->baseDir . "/shared/log"; - if (defined('PATH_DATA')) { - $this->logDir = PATH_DATA . "log"; - $this->buildTempDir = PATH_DATA . "buildTemp"; - } - $this->utils->__set("logDir", $this->logDir); - $this->utils->refreshDir($this->buildTempDir); - if (!file_exists($this->publicDir)) { - $this->utils->exitCode(5); - } - // Check mode dev or prod, by default prod - $this->mode = (empty($config['mode'])) ? 'prod' : strtolower($config['mode']); - $this->extension = (empty($config['extension'])) ? false : true; - $this->theme = (empty($config['theme'])) ? 'mafe' : $config['theme']; - - switch ($this->mode) { - case 'prod': - $this->utils->echoContent("Running Production mode."); - $this->dir['targetDir'] = $this->publicDir . "/lib"; - break; - case 'dev': - $this->utils->echoContent("Running Developer mode."); - $this->dir['targetDir'] = $config['publicDir'] . "/lib-dev"; - break; - default: - $this->utils->exitCode(6); - break; - } - $this->dir['pmUIFontsDir'] = $this->dir['targetDir'] . "/fonts"; - - // Config Directories - $this->dir['jsTargetDir'] = $this->dir['targetDir'] . "/js"; - $this->dir['cssTargetDir'] = $this->dir['targetDir'] . "/css"; - $this->dir['cssImagesTargetDir'] = $this->dir['cssTargetDir'] . "/images"; - $this->dir['imgTargetDir'] = $this->dir['targetDir'] . "/img"; - - $this->dir['pmUIDir'] = $this->dir['targetDir'] . "/pmUI"; - $this->dir['mafeDir'] = $this->dir['targetDir'] . "/mafe"; - $this->dir['pmdynaformDir'] = $this->dir['targetDir'] . "/pmdynaform"; - - // TODO This clean function must be used only if we need to remove cache from a rake build; - // don't use it for now - if ($clean) { - $this->utils->echoContent("Preparing dirs..."); - $this->utils->prepare_dirs($this->dir); - } - // After delete add this - $this->dir['baseDir'] = $this->baseDir; - $this->dir['publicDir'] = $this->publicDir . "/workflow/public_html"; - $this->dir['extensionDir'] = (empty($config['extensionDir'])) ? $this->baseDir . "workflow/engine/plugins" : $config['extensionDir']; - - return $config; - } - - /** - * Main Build Function - */ - public function buildAll() - { - $this->buildPmUi(); - $this->buildMafe(); - $this->buildPMDynaform(); - - $hashVendors = $this->versions->pmui_hash . "-" . $this->versions->mafe_hash; - // Building minified JS Files - $mafeCompresedFile = $this->dir['targetDir'] . "/js"; - $files = $this->utils->getJsIncludeFiles(); - $this->utils->minifyFiles("mafe-$hashVendors", 'js', $files, $this->dir['baseDir'] . "/", - $mafeCompresedFile . "/", false); - - // Building minified CSS - $mafeCompresedFile = $this->dir['targetDir'] . "/css"; - $files = $this->utils->getCssIncludeFiles(); - $this->utils->minifyFiles("mafe-$hashVendors", 'css', $files, $this->dir['baseDir'] . "/", - $mafeCompresedFile . "/", false); - - //Create build-hash file - $this->utils->echoContent("Create File: buildhash"); - $this->utils->writeToFile("buildhash", $this->dir['targetDir'], $hashVendors, true); - - //Create versions file - $this->utils->echoContent("Create File: versions"); - $versionsContent = json_encode($this->versions); - $this->utils->writeToFile("versions", $this->dir['targetDir'], $versionsContent, true); - $this->cleanUp(); - $this->utils->exitCode(0); - } - - /** - * Builds PMUI - * @return array|Exception - */ - public function buildPmUi() - { - try { - $this->utils->echoHeader("Building PMUI Library"); - // Return Values - $response = array(); - $response['success'] = false; - $response['js'] = ""; - $response['css'] = ""; - $response['customjs'] = false; - $response['customcss'] = false; - $response['hash'] = ""; - $response['version'] = ""; - - $source = $this->dir['baseDir'] . "/vendor/colosa/pmUI"; - $target = $this->dir['targetDir']; - $pmUIDir = $target . "/pmUI"; - $pmUIFontsDir = $target . "/fonts"; - $jsTargetDir = $target . "/js"; - $cssTargetDir = $target . "/css"; - $imgTargetDir = $target . "/img"; - //first hash - $vh = $this->utils->getHash($source); - $this->versions->pmui_hash = $vh['hash']; - - $version = file_get_contents($source . '/VERSION.txt'); - $this->versions->pmui_ver = $version; - $response['version'] = $version; - - $themeDir = $this->dir['baseDir'] . "/vendor/colosa/MichelangeloFE/themes/"; - $themeDir = $themeDir . $this->theme; - - $this->utils->echoContent("1.- Copying lib files into: $pmUIDir"); - $this->utils->copy("$source/build/js/pmui-$version.js", "$pmUIDir/pmui.min.js"); - $this->utils->copy("$themeDir/build/pmui-$this->theme.css", "$pmUIDir/pmui.min.css"); - $this->utils->recCopy("$themeDir/build/images", "$target/css/images"); - $this->utils->recCopy("$source/img", $imgTargetDir); - - $this->utils->echoContent("2.- Copying lib files into: $jsTargetDir"); - $this->utils->copy("$source/libraries/restclient/restclient-min.js", "$jsTargetDir/restclient.min.js"); - - $this->utils->echoContent("3.- Copying font files into: $pmUIFontsDir"); - $this->utils->recCopy("$source/themes/$this->theme/fonts", $pmUIFontsDir); - - $this->utils->echoFooter("PMUI Build Finished!"); - $response['success'] = true; - - return $response; - } catch (Exception $e) { - $this->utils->exitCode(8, $e); - - return $e; - } - } - - /** - * Builds MAFE Files - * @return array|Exception - */ - function buildMafe() - { - try { - $this->utils->echoHeader("Building PM Michelangelo FE"); - - $target = $this->dir['targetDir']; - $source = $this->baseDir . "/vendor/colosa/MichelangeloFE"; - $buildTempDir = $this->buildTempDir . "/vendor/colosa/MichelangeloFE"; - $mafeDir = $target . "/mafe"; - $jsTargetDir = $target . "/js"; - $cssTargetDir = $target . "/css"; - $imgTargetDir = $target . "/img"; - - $response = array(); - $response['success'] = false; - $response['js'] = ""; - $response['css'] = ""; - $response['customjs'] = false; - $response['customcss'] = false; - $response['hash'] = ""; - - $vh = $this->utils->getHash($source); - $this->versions->mafe_hash = $vh['hash']; - $this->versions->mafe_ver = $vh['version'] . '.' . $vh['hash']; - - // Loads all plugins - $pluginDir = $this->extension ? $this->utils->getExtensionsDirArray($this->dir['extensionDir']) : false; - if ($this->extension) { - // Loads all enabled Plugins - $pluginAdd = "/colosa/MichelangeloFE"; - if (!empty($this->enabledExtensions)) { - $pluginDir = $this->utils->prependPluginDir($this->enabledExtensions, $this->dir['extensionDir']); - } - $pluginDir = $this->utils->appendPluginDir($pluginDir, $pluginAdd); - - } - - $buildConfig = $source . "/config/build.json"; - $mafeSources = file_get_contents($buildConfig); - $mafeConfig = $this->utils->json_clean_decode($mafeSources); - foreach ($mafeConfig as $lib) { - $this->utils->minifyByConfig($lib, $source, $buildTempDir, false, $pluginDir); - } - - //Compress App Files - $appBuildConfig = $source . "/config/applications.json"; - $appMafeSources = file_get_contents($appBuildConfig); - $appConfig = $this->utils->json_clean_decode($appMafeSources); - foreach ($appConfig as $lib) { - $this->utils->minifyByConfig($lib, $source, $buildTempDir, false, $pluginDir); - } - - // Copying files to mafe Dir - $this->utils->echoContent("Copying files into: $mafeDir"); - $this->utils->recCopy($source . "/lib/jQueryUI/images/", $cssTargetDir . "/images/"); - //Compiled Libraries from buildTemp directory - $this->utils->copyIfExist($source, "/build/js/designer.js", $mafeDir, "/designer.min.js", $buildTempDir); - $this->utils->copyIfExist($source, "/build/js/mafe.js", $mafeDir, "/mafe.min.js", $buildTempDir); - $this->utils->copyIfExist($source, "/build/css/mafe.css", $mafeDir, "/mafe.min.css", $buildTempDir); - - $this->utils->recCopy($source . "/img", $imgTargetDir); - // IMPROVEMENT Register files that have been copied to $imgTargetdir as a plugin consequence - if ($pluginDir) { - foreach ($pluginDir as $row) { - $this->utils->recCopy($row . "/img", $imgTargetDir); - } - } - - $this->utils->echoContent("Copying files into: $jsTargetDir"); - - $this->utils->copy($source . "/lib/wz_jsgraphics/wz_jsgraphics.js", $jsTargetDir . "/wz_jsgraphics.js"); - $this->utils->copy($source . "/lib/jQuery/jquery-1.10.2.min.js", $jsTargetDir . "/jquery-1.10.2.min.js"); - $this->utils->copy($source . "/lib/underscore/underscore-min.js", $jsTargetDir . "/underscore-min.js"); - $this->utils->copy($source . "/lib/jQueryUI/jquery-ui-1.10.3.custom.min.js", - $jsTargetDir . "/jquery-ui-1.10.3.custom.min.js"); - $this->utils->copy($source . "/lib/jQueryLayout/jquery.layout.min.js", - $jsTargetDir . "/jquery.layout.min.js"); - $this->utils->copy($source . "/lib/modernizr/modernizr.js", $jsTargetDir . "/modernizr.js"); - - $this->utils->recCopy($source . "/src/formDesigner/img/", $target . "/img"); - $this->utils->echoFooter("Michelangelo FE Build Finished"); - $response['success'] = true; - - return $response; - } catch (Exception $e) { - $this->utils->exitCode(9, $e); - - return $e; - } - - } - - /** - * Builds PMDynaform, not implemented yet - * temporally gets hash and version for main file Versions - * Take a look of buildPMDynaform of PHPBuilderUtils to improve this function - * @return Exception|null - */ - function buildPMDynaform() - { - try { - $target = $this->dir['targetDir']; - $source = $this->baseDir . "/vendor/colosa/pmDynaform"; - $vh = $this->utils->getHash($source); - $this->versions->pmdynaform_hash = $vh['hash']; - $this->versions->pmdynaform_ver = $vh['version'] . "." . $vh['hash']; - - $response = null; - - return $response; - } catch (Exception $e) { - $this->utils->exitCode(10, $e); - - return $e; - } - } - - /** - * Clean up function after build - * - */ - function cleanUp() - { - try { - $this->utils->delTree($this->buildTempDir); - } catch (Exception $e) { - $this->utils->log($e); - } - } -} - -/** - * Class PhpBuilderUtils - * Php Builder Utils has methods as recursive copy, write and minify files - */ -class PhpBuilderUtils -{ - /** - * Extension config File Directory location. - * - * @var string - */ - public $extensionsJsConfig; - public $logger; - public $logDir; - public $pathSep; - - /** - * Class constructor. - * - */ - public function __construct() - { - $this->extensionsJsConfig = ""; - $this->silentMode = false; - $this->logger = array(); - $this->logDir = ""; - if (defined('PATH_SEP')) { - $this->pathSep = PATH_SEP; - } else { - $this->pathSep = "/"; - } - } - - /** - * Get Function of class key - * @param string $key - * @return $value - */ - public function __get($key) - { - return $this->$key; - } - - /** - * Set Function of class key - * @param string $key - * @param string $value - * - */ - public function __set($key, $value) - { - $this->$key = $value; - } - - /** - * Logger function. - * - * @param mixed $e - */ - public function log($e) - { - $this->logger[] = $e; - } - - /** - * Recursive copy of directories, - * can be updated with compare values and overwrite if newer - * @param string $src Source directory - * @param string $dst Target directory - * @param bool $delete Deletes directory first, copy after delete - * - */ - function recCopy($src, $dst, $delete = false) - { - if ($delete && file_exists($dst)) { - $this->delTree($dst); - } - if (is_dir($src)) { - if (!file_exists($dst) && is_writable($dst)) { - mkdir($dst); - } else { - $this->log("File doesn't exist or directory is not writable, file: $dst \n"); - } - $files = scandir($src); - foreach ($files as $file) { - if ($file != "." && $file != "..") { - $this->recCopy("$src/$file", "$dst/$file"); - } - } - } else { - $this->copy($src, $dst); - } - } - - public function copy($src, $dst) - { - try { - if (file_exists($src) && is_writable($dst)) { - copy($src, $dst); - } else { - $this->log("File doesn't exist or directory is not writable, file: $dst \n"); - } - } catch (Exception $e) { - $this->log($e); - } - } - - /** - * Copy tmp File if exists, else copy file from source - * - * @param $source - * @param $file - * @param $dest - * @param $destFile - * @param $tmp - */ - function copyIfExist($source, $file, $dest, $destFile, $tmp) - { - if (file_exists($tmp . $file)) { - $this->copy($tmp . $file, $dest . $destFile); - } else { - $this->copy($source . $file, $dest . $destFile); - } - } - - /** - * Force write file if directory doesn't exist - * - * @param $dir - * @param $contents - */ - function file_force_contents($dir, $contents) - { - $parts = explode($this->pathSep, $dir); - $file = array_pop($parts); - $dir = ''; - foreach ($parts as $part) { - if (!is_dir($dir .= $part . $this->pathSep)) { - mkdir($dir, 0777, true); - } - } - $this->file_put_contents($this->pathSep . $file, $dir, $contents); - } - - public function file_put_contents($file, $dir = "", $contents) - { - $dst = $dir . $file; - try { - if (is_writable($dir)) { - file_put_contents($dst, $contents); - } else { - $this->log("Cannot write file, check directory permissions, file: $dst \n"); - } - } catch (Exception $e) { - $this->log($e); - } - } - - /** - * Clean decode of json string, removes comment lines - * @param string $json Json string being decoded - * @param bool $assoc When TRUE return as associative array - * @param int $depth User specified recursion depth - * @param int $options Decode options - * @return mixed Value encoded in Json, False and Null - * - */ - function json_clean_decode($json, $assoc = false, $depth = 512, $options = 0) - { - // Search and remove comments like /* */ and // - $json = preg_replace("#(/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/)|([\s\t]//.*)|(^//.*)#", '', $json); - - if (version_compare(phpversion(), '5.4.0', '>=')) { - $json = json_decode($json, $assoc, $depth, $options); - } elseif (version_compare(phpversion(), '5.3.0', '>=')) { - $json = json_decode($json, $assoc, $depth); - } else { - $json = json_decode($json, $assoc); - } - - return $json; - } - - /** - * Clean up directories - * @param array $dirs Array of directories to remove and create - * - */ - - function prepare_dirs($dirs) - { - foreach ($dirs as $dir) { - $this->refreshDir($dir, true); - } - } - - /** - * Clean up directories - * @param string $dir Directory to remove and create - * @param bool $showDetail When TRUE echoes directory create action - * - */ - function refreshDir($dir, $showDetail = false) - { - if (is_writable($dir)) { - $this->delTree($dir); - } elseif (!file_exists($dir)) { - //todo check conditionals - } else { - $this->exitCode(7, $dir); - } - //Todo change the permissions here - mkdir($dir, 0777); - if ($showDetail) { - $this->echoContent("Create: $dir"); - } - } - - /** - * Delete a tree directory structure - * @param array $dir Directories - * @return bool True if success, otherwise False - */ - function delTree($dir) - { - $files = array_diff(scandir($dir), array('.', '..')); - foreach ($files as $file) { - (is_dir("$dir/$file")) ? $this->delTree("$dir/$file") : unlink("$dir/$file"); - } - - return rmdir($dir); - } - - /** - * Echo content - * @param string $content String to show - * - */ - function echoContent($content) - { - if (!$this->silentMode) { - echo "$content\n"; - } - } - - /** - * Echo content with Format - * @param string $content String to show - * - */ - function echoHeader($content) - { - if (!$this->silentMode) { - echo "\n\e[1;34m$content\033[0m\n"; - } - } - - /** - * Echo content with Format - * @param string $content String to show - * - */ - function echoFooter($content) - { - if (!$this->silentMode) { - echo "\n\e[1;32m$content\033[0m\n"; - } - } - - /** - * Echo content with Format - * @param string $content String to show - * - */ - function echoError($content = "Error") - { - echo "\n\e[1;31m$content\033[0m\n"; - } - - /** - * Echo content with Format - * @param string $content String to show - * - */ - function echoWarning($content = "Please review files") - { - if (!$this->silentMode) { - echo "\n\e[1;33m$content\033[0m\n"; - } - } - - /** - * Write String to file - * @param string $filename String with filename, please include extension - * @param string $directory Directory of file - * @param string $contents Content to be written - * @param bool $overwrite Replace or append content to file, True when you want to overwrite it - * - */ - function writeToFile($filename, $directory, $contents, $overwrite = true) - { - $current = file_exists($directory . "/" . $filename) ? file_get_contents($directory . "/" . $filename) : ""; - if (!$overwrite) { - $current .= $contents; - } else { - $current = $contents; - } - $this->file_put_contents("/$filename", $directory, $current); - } - - /** - * Recursive add a directory content to zip file - * @param mixed $zip - * @param String $dir Directory - * @param String $base Base directory - * @return mixed - */ - function addDirectoryToZip($zip, $dir, $base) - { - $newFolder = str_replace($base, '', $dir); - $zip->addEmptyDir($newFolder); - foreach (glob($dir . '/*') as $file) { - if (is_dir($file)) { - $zip = $this->addDirectoryToZip($zip, $file, $base); - } else { - $newFile = str_replace($base, '', $file); - $zip->addFile($file, $newFile); - } - } - - return $zip; - } - - /** - * Returns Directory as array from all extensions. - * @param String $baseDir Base dir of a Process Maker Installation - * @return array - */ - function getExtensionsDirArray($baseDir) - { - return $this->directoryToArray($baseDir, false, true, false); - } - - /** - * Returns directory files as array without .. and . - * @param String $directory - * @return array - */ - function dirContent($directory) - { - return array_diff(scandir($directory), array('..', '.')); - } - - /** - * Get an array that represents directory tree - * @param string $directory Directory path - * @param bool $recursive Include sub directories - * @param bool $listDirs Include directories on listing - * @param bool $listFiles Include files on listing - * @param regex $exclude Exclude paths that matches this regex - * @return array $arrayItems Directory tree - */ - function directoryToArray($directory, $recursive = true, $listDirs = false, $listFiles = true, $exclude = '') - { - $arrayItems = array(); - $skipByExclude = false; - if (!file_exists($directory)) { - return $arrayItems; - } - $handle = opendir($directory); - if ($handle) { - while (false !== ($file = readdir($handle))) { - preg_match("/(^(([\.]){1,2})$|(\.(svn|git|md))|(Thumbs\.db|\.DS_STORE))$/iu", $file, $skip); - if ($exclude) { - preg_match($exclude, $file, $skipByExclude); - } - if (!$skip && !$skipByExclude) { - if (is_dir($directory . DIRECTORY_SEPARATOR . $file)) { - if ($recursive) { - $arrayItems = array_merge($arrayItems, - $this->directoryToArray($directory . DIRECTORY_SEPARATOR . $file, $recursive, $listDirs, - $listFiles, $exclude)); - } - if ($listDirs) { - $file = $directory . DIRECTORY_SEPARATOR . $file; - $arrayItems[] = $file; - } - } else { - if ($listFiles) { - $file = $directory . DIRECTORY_SEPARATOR . $file; - $arrayItems[] = $file; - } - } - } - } - closedir($handle); - } - - return $arrayItems; - } - - /** - * Minify files by read config of json file, use this with PMUI and MAFE build.json - * - * @param Object $lib Config read from build.json - * @param String $source Source directory - * @param String $target Target directory - * @param bool $addMinExt When TRUE, adds '.min' before extension - * @param bool $addPluginFiles When TRUE, search from extensions folders to append to build file - */ - function minifyByConfig($lib, $source, $target, $addMinExt = false, $addPluginFiles = false) - { - // Todo Please standardize target_dir or target_to from config files - $target_dir = !empty($lib->target_dir) ? $lib->target_dir : $lib->target_to; - $sourceFrom = ""; - if (!empty($lib->target_from)) { - $sourceFrom = $lib->target_from . "/"; - if ($addPluginFiles) { - $addPluginFiles = $this->appendPluginDir($addPluginFiles, "/" . $sourceFrom); - } - } - $files = $lib->files; - if ($addMinExt) { - $lib->name = $lib->name . ".min"; - } - switch ($lib->extension) { - case "js": - $this->echoContent("Building Js File"); - $this->minifyFiles($lib->name, 'js', $files, $source . "/" . $sourceFrom, $target . "/$target_dir", - $addPluginFiles); - break; - case "css": - $this->echoContent("Building Css File"); - $this->minifyFiles($lib->name, 'css', $files, $source . "/", $target . "/$target_dir", $addPluginFiles); - break; - default: - $this->echoWarning('No extension defined or usable to build file'); - break; - } - } - - /** - * Build minified file from files - * TODO Include a minifier as else statement - * @param String $name Filename of target - * @param String $extension Extension of file (css, js) - * @param Array $files Array with names of files to include into build file - * @param String $basePath Source directory to search files - * @param String $targetPath Target directory to save build file - * @param bool $addPlugin When TRUE, includes files from Plugin-Extensions folders - * @param bool $minify When TRUE, minify the files, NOT INCLUDED YET. - * @return bool|mixed|string - */ - function minifyFiles($name, $extension, $files, $basePath, $targetPath, $addPlugin = false, $minify = false) - { - if (!$minify) { - $minifiedPath = $targetPath . $name . "." . $extension; - $content = ""; - $content = $content . $this->joinFiles($basePath, $files, $addPlugin); - $this->file_force_contents($minifiedPath, $content); - - return $content; - } - - return false; - } - - /** - * Appends Plugin-Extension Directory to every file in - * @param Array $pluginDir - * @param String $pluginAdd - * @return Array - */ - function appendPluginDir($pluginDir, $pluginAdd) - { - foreach ($pluginDir as $key => $row) { - $pluginDir[$key] = $row . $pluginAdd; - } - - return $pluginDir; - } - - /** - * Prepend Plugin-Extension Directory to every file in - * @param Array $pluginDir - * @param String $baseDir - * @return Array - */ - function prependPluginDir($pluginDir, $baseDir) - { - foreach ($pluginDir as $key => $row) { - $pluginDir[$key] = $baseDir . '/' . $row; - } - - return $pluginDir; - } - - /** - * Join files into one - * @param string $baseDir Base file of Directory - * @param array $files file source array - * @param bool $plugin When True, searches for extensions files - * @param string $separator Custom file separator - * @return string $content File contents - */ - function joinFiles($baseDir, $files, $plugin = false, $separator = "\n") - { - $content = ""; - foreach ($files as $file) { - $content = $content . file_get_contents("$baseDir/$file") . $separator; - if ($plugin && is_array($plugin)) { - foreach ($plugin as $row) { - if (file_exists("$row/$file")) { - $content = $content . file_get_contents("$row/$file") . $separator; - $this->echoWarning("Custom code added for: $row/$file"); - } - } - } - } - - return $content; - } - - /** - * Get hash and version of repositories - * @param string $source Base directory of repository - * @return array $values with hash and version of repository - */ - function getHash($source) - { - $values = []; - $values['hash'] = substr(md5($source), 0, 7); - $values['version'] = '1.0.0'; - - return $values; - } - - /** - * Get Git hash and version of repositories - * @param string $source Base directory of repository - * @return array $values with hash and version of repository - */ - function getGitHash($source) - { - $cwd = getcwd(); - chdir($source); - exec('git rev-parse --short HEAD', $hashes); - exec('git rev-parse --abbrev-ref HEAD', $version); - chdir($cwd); - $values = []; - $values['hash'] = !empty($hashes[0]) ? $hashes[0] : ''; - $values['version'] = !empty($version[0]) ? $version[0] : ''; - - return $values; - } - - /** - * Shows help - */ - function showHelpDerp() - { - echo <<echoFooter("-- DONE --"); - break; - case 4: - $this->showHelpDerp(); - break; - case 5: - $this->echoContent("This ain't no Process Maker install directory mate"); - $this->echoContent("Please check if your executing this file into processmaker"); - $this->echoContent("Pro tip: You can also specify the base dir with: --base_dir=\"path/to/processmaker\""); - break; - case 6: - $this->echoContent("Mode doesn't exist pal. Use prod or dev mode."); - break; - case 7: - $this->echoError("Error. Directory $contents is not writable, please check permissions."); - break; - case 8: - $this->echoError("Error when building PMUI, please review logs."); - $this->echoContent($contents); - break; - case 9: - $this->echoError("Error when building MAFE, please review logs."); - $this->echoContent($contents); - break; - case 10: - $this->echoError("Error when building MAFE, please review logs."); - $this->echoContent($contents); - break; - default: - $this->echoContent("Exit Code Not found, exit anyway lol"); - break; - } - $this->writeToFile("build.log", $this->logDir, $this->logger); - exit($code); - } - - /** - * Read arguments Helper - * @return array - */ - public function readArguments() - { - // Read arguments - global $argv; - if (!isset($config)) { - $config = array(); - } - if (isset($argv)) { - foreach ($argv as $arg) { - if (substr($arg, 0, 2) == '--') { - $arg = substr($arg, 2, strlen($arg)); - } - if (substr($arg, 0, 1) == '-') { - $arg = substr($arg, 1, strlen($arg)); - } - $params = explode('=', $arg); - if (count($params) > 1) { - $config[$params[0]] = $params[1]; - } else { - $config[$params[0]] = true; - } - } - } - - return $config; - } - - /** - * Include files to minify, this array is a copy from rake include files - * @return array - */ - function getJsIncludeFiles() - { - - $includeFiles = [ - "workflow/public_html/lib/js/wz_jsgraphics.js", - "workflow/public_html/lib/js/jquery-1.10.2.min.js", - "workflow/public_html/lib/js/underscore-min.js", - "workflow/public_html/lib/js/jquery-ui-1.10.3.custom.min.js", - "workflow/public_html/lib/js/jquery.layout.min.js", - "workflow/public_html/lib/js/modernizr.js", - "workflow/public_html/lib/js/restclient.min.js", - "workflow/public_html/lib/pmUI/pmui.min.js", - "workflow/public_html/lib/mafe/mafe.min.js", - "workflow/public_html/lib/mafe/designer.min.js", - "gulliver/js/tinymce/jscripts/tiny_mce/tiny_mce.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmGrids/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmSimpleUploader/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/pmVariablePicker/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/visualchars/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/wordcount/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/visualblocks/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/table/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/template/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/visualblocks/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/preview/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/print/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/style/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/save/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/tabfocus/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/searchreplace/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/paste/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/media/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/lists/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/insertdatetime/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/example/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/pagebreak/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/example_dependency/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/noneditable/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/fullpage/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/layer/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/legacyoutput/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/fullscreen/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/iespell/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/inlinepopups/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/autoresize/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/contextmenu/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/advlist/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/autolink/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/directionality/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/emotions/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/themes/advanced/editor_template.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/advhr/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/advlink/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/advimage/editor_plugin.js", - "gulliver/js/tinymce/jscripts/tiny_mce/plugins/nonbreaking/editor_plugin.js", - "gulliver/js/codemirror/lib/codemirror.js", - "gulliver/js/codemirror/addon/hint/show-hint.js", - "gulliver/js/codemirror/addon/hint/javascript-hint.js", - "gulliver/js/codemirror/addon/hint/sql-hint.js", - "gulliver/js/codemirror/addon/hint/php-hint.js", - "gulliver/js/codemirror/addon/hint/html-hint.js", - "gulliver/js/codemirror/mode/javascript/javascript.js", - "gulliver/js/codemirror/addon/edit/matchbrackets.js", - "gulliver/js/codemirror/mode/htmlmixed/htmlmixed.js", - "gulliver/js/codemirror/mode/xml/xml.js", - "gulliver/js/codemirror/mode/css/css.js", - "gulliver/js/codemirror/mode/clike/clike.js", - "gulliver/js/codemirror/mode/php/php.js", - "gulliver/js/codemirror/mode/sql/sql.js", - ]; - - return $includeFiles; - } - - /** - * Include files to minify, this array is a copy from rake include files - * @return array - */ - function getCssIncludeFiles() - { - return [ - "gulliver/js/codemirror/lib/codemirror.css", - "gulliver/js/codemirror/addon/hint/show-hint.css", - "workflow/public_html/lib/pmUI/pmui.min.css", - "workflow/public_html/lib/mafe/mafe.min.css", - ]; - } - - /** - * pmUITheme config helper, from ruby config file - * @return array - */ - function pmUIThemeConfigRB() - { - return [ - 'http_path' => "/", - 'css_dir' => "./css", - 'sass_dir' => "./src/sass", - 'images_dir' => "./img", - 'javascripts_dir' => "./src", - 'http_generated_images_path' => "../img", - 'http_fonts_path' => '../fonts', - ]; - } - - /** - * Build PMDynaform Wannabe, - * TODO USE IT AS BASE TO A REAL DYNAFORM BUILDER, SCRIPT IS NOT COMPLETE - * @param $home - * @param $target - * @param $mode - */ - function buildPmdynaform($home, $target, $mode) - { - $source = $home . "/vendor/colosa/pmDynaform"; - - $this->echoHeader("Building PmDynaform Library"); - - $pmdynaformDir = $target . "/pmdynaform"; - - if (!file_exists("$pmdynaformDir/build")) { - mkdir("$pmdynaformDir/build", 0777); - } - $this->recCopy("$source/build", "$pmdynaformDir/build", false); - if (!file_exists("$pmdynaformDir/libs")) { - mkdir("$pmdynaformDir/libs", 0777); - } - $this->recCopy("$source/libs", "$pmdynaformDir/libs", false); - $config = file_get_contents($source . "/config/templates.json"); - $config = $this->json_clean_decode($config); - $template = ""; - - foreach ($config as $tmp) { - - $s = $this->joinFiles($source, $tmp->files); - $template = $template . $s; - } - - // todo review something else within Dynaform - - $this->echoFooter("PMUI Dynaform Finished!"); - } - - /** - * Build PMDynaformZip Wannabe, - * TODO USE IT AS BASE TO A REAL DYNAFORMZIP BUILDER - * @param $home - * @param $target - * @param $mode - */ - function buildPmdynaformZip($home, $target, $mode) - { - $source = $home . "/vendor/colosa/pmDynaform"; - - $this->echoHeader("Building Compress Zip Library"); - // if ($mode == "dev"){ - $minified = [ - "src/language/en.js", - "src/PMDynaform.js", - "src/core/Selector.js", - "src/core/Utils.js", - "src/core/Mask.js", - "src/core/Validators.js", - "src/core/Project.js", - "src/core/Formula.js", - "src/core/PMRest.js", - "src/core/TransformJSON.js", - "src/core/FileStream.js", - "src/core/FullScreen.js", - "src/core/Script.js", - "src/util/ArrayList.js", - "src/extends/core/ProjectMobile.js", - "src/implements/WebServiceManager.js", - "src/extends/core/ProcessFlow.js", - "src/extends/core/ProcessFlowIOS.js", - "src/extends/core/FormsHandler.js", - "src/extends/core/DataLocalManager.js", - "src/extends/views/MediaElement.js", - "src/proxy/RestProxy.js", - "src/views/Validator.js", - "src/views/Panel.js", - "src/views/FormPanel.js", - "src/views/Field.js", - "src/views/Grid.js", - "src/views/GridMobile.js", - "src/views/Button.js", - "src/views/DropDown.js", - "src/views/Radio.js", - "src/views/Submit.js", - "src/views/TextArea.js", - "src/views/Text.js", - "src/views/File.js", - "src/views/CheckBox.js", - "src/views/CheckGroup.js", - "src/views/Suggest.js", - "src/views/Link.js", - "src/views/Label.js", - "src/views/Title.js", - "src/views/Empty.js", - "src/views/Hidden.js", - "src/views/Image.js", - "src/views/SubForm.js", - "src/views/GeoMap.js", - "src/views/Annotation.js", - "src/views/Datetime.js", - "src/views/PanelField.js", - "src/extends/views/ScannerCode.js", - "src/extends/views/Signature.js", - "src/extends/views/Geo.js", - "src/extends/views/FileMobile.js", - "src/models/Validator.js", - "src/models/Panel.js", - "src/models/FormPanel.js", - "src/models/Field.js", - "src/models/Grid.js", - "src/models/Button.js", - "src/models/DropDown.js", - "src/models/Radio.js", - "src/models/Submit.js", - "src/models/TextArea.js", - "src/models/Text.js", - "src/models/File.js", - "src/models/CheckBox.js", - "src/models/CheckGroup.js", - "src/models/Datetime.js", - "src/models/Suggest.js", - "src/models/Link.js", - "src/models/Label.js", - "src/models/Title.js", - "src/models/Empty.js", - "src/models/Hidden.js", - "src/models/Image.js", - "src/models/SubForm.js", - "src/models/GeoMap.js", - "src/models/Annotation.js", - "src/extends/models/ScannerCode.js", - "src/extends/models/Signature.js", - "src/extends/models/Geo.js", - "src/extends/models/FileMobile.js", - "src/models/PanelField.js", - "src/extends/core/get_scripts.js" - ]; - $index = [ - 'appMobile/form-dev.html', - "src/templates/template.html", - "src/templates/controls.html", - "src/templates/GridTemplate.html", - "src/templates/GeoMapTemplate.html", - "src/templates/annotation.html", - "src/templates/Qrcode_mobile.html", - "src/templates/Signature_mobile.html", - "src/templates/GeoMobile.html", - "src/templates/FileMobile.html", - "src/templates/PanelField.html", - 'appMobile/form-dev2.html' - ]; - - $dev = $source . "/build-dev"; - $css = $dev . "/css"; - $js = $dev . "/js"; - $img = $dev . "/img"; - $libs = $dev . "/libs"; - - - $this->refreshDir($dev); - $this->refreshDir($css); - $this->refreshDir($js); - $this->refreshDir($img); - $this->refreshDir($libs); - $this->recCopy($source . "/fonts", $css . "/fonts", false); - - $this->minifyFiles('pmDynaform', 'js', $minified, $source . "/", $dev . "/js/", false); - $this->recCopy($source . "/libs", $dev . "/libs", false); - $this->copy($source . "/appMobile/appBuild.js", $dev . "/appBuild.js"); - $this->copy($source . "/img/geoMap.jpg", $dev . "/geoMap.jpg"); - $htmlFile = $this->joinFiles($source, $index); - $this->file_put_contents("/index.html", $dev, $htmlFile); - - $cssmin = [ - "libs/bootstrap-3.1.1/css/bootstrap.min.css", - "libs/datepicker/bootstrap-datetimepicker.css", - "css/pmDynaform.css" - ]; - $minified = [ - "libs/jquery/jquery-1.11.js", - "libs/bootstrap-3.1.1/js/bootstrap.min.js", - "libs/datepicker/bootstrap-datetimepicker.js", - "libs/underscore/underscore-1.6.js", - "libs/backbone/backbone-min.js", - "libs/restclient/restclient.js", - "js/pmDynaform.js" - ]; - $index = [ - "appMobile/form-prod.html", - "src/templates/template.html", - "src/templates/controls.html", - "src/templates/GridTemplate.html", - "src/templates/GeoMapTemplate.html", - "src/templates/annotation.html", - "src/templates/Qrcode_mobile.html", - "src/templates/Signature_mobile.html", - "src/templates/GeoMobile.html", - "src/templates/FileMobile.html", - "src/templates/PanelField.html", - "appMobile/form-prod2.html" - ]; - - $prod = $source . "/build-prod"; - $zipProd = $source . "/build-prod-zip"; - $css = $prod . "/css"; - $js = $prod . "/js"; - $img = $prod . "/img"; - - $this->refreshDir($prod); - $this->refreshDir($css); - $this->refreshDir($js); - $this->refreshDir($img); - - $this->recCopy($source . "/fonts", $css . "/fonts", false); - $this->recCopy($dev . "/libs/bootstrap-3.1.1/fonts/", $prod . "/fonts/", false); - - - $this->minifyFiles('pmDynaform.min', 'css', $cssmin, $dev . "/", $prod . "/css/", false); - $this->minifyFiles('pmDynaform.min', 'js', $minified, $dev . "/", $prod . "/js/", false); - - $this->copy($source . "/appMobile/appBuild.js", $prod . "/appBuild.js"); - $this->copy($source . "/img/geoMap.jpg", $prod . "/geoMap.jpg"); - $this->recCopy($source . "/img", $prod . "/img", false); - $htmlFile = $this->joinFiles($source, $index); - $this->file_put_contents("/index.html", $prod, $htmlFile); - - - // Create Zip File - $this->refreshDir($zipProd); - $directoryToZip = $source . "/build-prod"; - $outputFile = "$zipProd/build-prod.zip"; - $zipFile = new ZipArchive(); - $zipFile->open($outputFile, ZipArchive::CREATE | ZipArchive::OVERWRITE); - $zipFile = $this->addDirectoryToZip($zipFile, $prod, $directoryToZip); - $zipFile->close(); - if (file_exists($outputFile)) { - copy($outputFile, $target . "/build-prod.zip"); - } - $this->echoFooter("PMUI Dynaform Zip Finished!"); - } -} - -/** - * Class Versions - * Helper to easy build Versions file - */ -class Versions -{ - public $pmui_ver = ""; - public $pmui_hash = ""; - public $mafe_ver = ""; - public $mafe_hash = ""; - public $pmdynaform_ver = ""; - public $pmdynaform_hash = ""; - - /** - * Get Function of class key - * @param string $key - * @return $value - */ - public function __get($key) - { - return $this->$key; - } - - /** - * Set Function of class key - * @param string $key - * @param string $value - * - */ - public function __set($key, $value) - { - $this->$key = $value; - } -} diff --git a/composer.lock b/composer.lock index d222efc71..f9ac617c7 100644 --- a/composer.lock +++ b/composer.lock @@ -55,7 +55,7 @@ "source": { "type": "git", "url": "git@bitbucket.org:colosa/michelangelofe.git", - "reference": "e0c591a07201ebfa2582a819680a1a25a1fdf719" + "reference": "cc19932a095b2232bef7998d2c90b2408ad9be19" }, "require": { "colosa/pmui": "release/3.2-dev" @@ -66,7 +66,7 @@ "keywords": [ "js app ProcessMaker" ], - "time": "2017-03-11 01:50:42" + "time": "2017-04-11 15:29:24" }, { "name": "colosa/pmDynaform", @@ -74,7 +74,7 @@ "source": { "type": "git", "url": "git@bitbucket.org:colosa/pmdynaform.git", - "reference": "e0c2d7b6b50331dacb30f31118c8546edca32007" + "reference": "17ac424d4f51c42c7812fdc117948eef45bddce8" }, "type": "library", "description": "JS Library to render ProcessMaker Dynaforms", @@ -82,7 +82,7 @@ "keywords": [ "js lib ProcessMaker Dynaforms" ], - "time": "2017-03-11 02:03:24" + "time": "2017-04-11 15:29:14" }, { "name": "colosa/pmUI", @@ -610,16 +610,16 @@ }, { "name": "symfony/config", - "version": "v2.8.18", + "version": "v2.8.19", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "06ce6bb46c24963ec09323da45d0f4f85d3cecd2" + "reference": "35b7dfa089d7605eb1fdd46281b3070fb9f38750" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/06ce6bb46c24963ec09323da45d0f4f85d3cecd2", - "reference": "06ce6bb46c24963ec09323da45d0f4f85d3cecd2", + "url": "https://api.github.com/repos/symfony/config/zipball/35b7dfa089d7605eb1fdd46281b3070fb9f38750", + "reference": "35b7dfa089d7605eb1fdd46281b3070fb9f38750", "shasum": "" }, "require": { @@ -662,20 +662,20 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2017-03-01T18:13:50+00:00" + "time": "2017-04-04T15:24:26+00:00" }, { "name": "symfony/console", - "version": "v2.8.18", + "version": "v2.8.19", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "81508e6fac4476771275a3f4f53c3fee9b956bfa" + "reference": "86407ff20855a5eaa2a7219bd815e9c40a88633e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/81508e6fac4476771275a3f4f53c3fee9b956bfa", - "reference": "81508e6fac4476771275a3f4f53c3fee9b956bfa", + "url": "https://api.github.com/repos/symfony/console/zipball/86407ff20855a5eaa2a7219bd815e9c40a88633e", + "reference": "86407ff20855a5eaa2a7219bd815e9c40a88633e", "shasum": "" }, "require": { @@ -723,7 +723,7 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2017-03-04T11:00:12+00:00" + "time": "2017-04-03T20:37:06+00:00" }, { "name": "symfony/debug", @@ -784,16 +784,16 @@ }, { "name": "symfony/dependency-injection", - "version": "v2.8.18", + "version": "v2.8.19", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "efdbeefa454a41154fd99a6f0489f0e9cb46c497" + "reference": "14b9d8ae69ac4c74e8f05fee7e0a57039b99c81e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/efdbeefa454a41154fd99a6f0489f0e9cb46c497", - "reference": "efdbeefa454a41154fd99a6f0489f0e9cb46c497", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/14b9d8ae69ac4c74e8f05fee7e0a57039b99c81e", + "reference": "14b9d8ae69ac4c74e8f05fee7e0a57039b99c81e", "shasum": "" }, "require": { @@ -843,20 +843,20 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2017-02-28T12:31:05+00:00" + "time": "2017-04-03T22:14:48+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v2.8.18", + "version": "v2.8.19", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "bb4ec47e8e109c1c1172145732d0aa468d967cd0" + "reference": "88b65f0ac25355090e524aba4ceb066025df8bd2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/bb4ec47e8e109c1c1172145732d0aa468d967cd0", - "reference": "bb4ec47e8e109c1c1172145732d0aa468d967cd0", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/88b65f0ac25355090e524aba4ceb066025df8bd2", + "reference": "88b65f0ac25355090e524aba4ceb066025df8bd2", "shasum": "" }, "require": { @@ -903,7 +903,7 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2017-02-21T08:33:48+00:00" + "time": "2017-04-03T20:37:06+00:00" }, { "name": "symfony/filesystem", @@ -1065,16 +1065,16 @@ }, { "name": "symfony/translation", - "version": "v2.8.18", + "version": "v2.8.19", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "b538355bc99db2ec7cc35284ec76d92ae7d1d256" + "reference": "047e97a64d609778cadfc76e3a09793696bb19f1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/b538355bc99db2ec7cc35284ec76d92ae7d1d256", - "reference": "b538355bc99db2ec7cc35284ec76d92ae7d1d256", + "url": "https://api.github.com/repos/symfony/translation/zipball/047e97a64d609778cadfc76e3a09793696bb19f1", + "reference": "047e97a64d609778cadfc76e3a09793696bb19f1", "shasum": "" }, "require": { @@ -1125,20 +1125,20 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2017-03-04T12:20:59+00:00" + "time": "2017-03-21T21:39:01+00:00" }, { "name": "symfony/yaml", - "version": "v2.8.18", + "version": "v2.8.19", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "2a7bab3c16f6f452c47818fdd08f3b1e49ffcf7d" + "reference": "286d84891690b0e2515874717e49360d1c98a703" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/2a7bab3c16f6f452c47818fdd08f3b1e49ffcf7d", - "reference": "2a7bab3c16f6f452c47818fdd08f3b1e49ffcf7d", + "url": "https://api.github.com/repos/symfony/yaml/zipball/286d84891690b0e2515874717e49360d1c98a703", + "reference": "286d84891690b0e2515874717e49360d1c98a703", "shasum": "" }, "require": { @@ -1174,7 +1174,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2017-03-01T18:13:50+00:00" + "time": "2017-03-20T09:41:44+00:00" } ], "aliases": [], diff --git a/gulliver/js/grid/core/grid.js b/gulliver/js/grid/core/grid.js index b386a0120..f1e4eebd7 100644 --- a/gulliver/js/grid/core/grid.js +++ b/gulliver/js/grid/core/grid.js @@ -563,6 +563,7 @@ var G_Grid = function(oForm, sGridName){ case 'textarea': //TEXTAREA aObjects = oNewRow.getElementsByTagName('td')[i].getElementsByTagName('textarea'); if (aObjects){ + aObjects[0].value = ''; aObjects[0].className = "module_app_input___gray"; newID = aObjects[0].id.replace(/\[1\]/g, '\[' + currentRow + '\]'); diff --git a/gulliver/js/maborak/core/maborak.js b/gulliver/js/maborak/core/maborak.js index a4c74b37b..ed51edd17 100644 --- a/gulliver/js/maborak/core/maborak.js +++ b/gulliver/js/maborak/core/maborak.js @@ -1345,7 +1345,7 @@ break;case'hidden':if((attributes.gridtype!="yesno"&&attributes.gridtype!="dropd newID=aObjects[n].id.replace(/\[1\]/g,'\['+currentRow+'\]');aObjects[n].id=newID;aObjects[n].name=newID;} break;case'button':if(aObjects[n].onclick){var onclickevn=new String(aObjects[n].onclick);eval('aObjects[n].onclick = '+onclickevn.replace(/\[1\]/g,'\['+currentRow+'\]')+';');} break;case"file":aObjects[n].value="";break;}}} -aObjects=null;break;case'textarea':aObjects=oNewRow.getElementsByTagName('td')[i].getElementsByTagName('textarea');if(aObjects){aObjects[0].className="module_app_input___gray";newID=aObjects[0].id.replace(/\[1\]/g,'\['+currentRow+'\]');aObjects[0].id=newID;aObjects[0].name=newID;attributes=elementAttributesNS(aObjects[0],'pm');if(attributes.defaultvalue!=''&&typeof attributes.defaultvalue!='undefined'){defaultValue=attributes.defaultvalue;}else{defaultValue='';} +aObjects=null;break;case'textarea':aObjects=oNewRow.getElementsByTagName('td')[i].getElementsByTagName('textarea');if(aObjects){aObjects[0].value='';aObjects[0].className="module_app_input___gray";newID=aObjects[0].id.replace(/\[1\]/g,'\['+currentRow+'\]');aObjects[0].id=newID;aObjects[0].name=newID;attributes=elementAttributesNS(aObjects[0],'pm');if(attributes.defaultvalue!=''&&typeof attributes.defaultvalue!='undefined'){defaultValue=attributes.defaultvalue;}else{defaultValue='';} aObjects[0].innerHTML=defaultValue;} aObjects=null;break;case'select':aObjects=oNewRow.getElementsByTagName('td')[i].getElementsByTagName('select');if(aObjects){newID=aObjects[0].id.replace(/\[1\]/g,'\['+currentRow+'\]');aObjects[0].id=newID;aObjects[0].name=newID;var oNewSelect=this.cloneElement(aObjects[0]);oNewSelect.id=newID;oNewSelect.name=newID;attributes=elementAttributesNS(aObjects[0],'pm');if(attributes.defaultvalue!=''&&typeof attributes.defaultvalue!='undefined'){defaultValue=attributes.defaultvalue;}else{defaultValue='';} var aDependents=this.allDependentFields.split(',');sObject=this.getObjectName(newID);var sw=false;for(x=0;xtmpDir = './'; $this->link = null; $this->dbName = null; - + $this->isWindows = strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'; if (isset( $host ) && isset( $user ) && isset( $passwd )) { $this->host = $host; $this->user = $user; @@ -399,32 +400,88 @@ class DataBaseMaintenance */ function backupDataBase ($outfile) { + $password = escapeshellarg($this->passwd); + + //On Windows, escapeshellarg() instead replaces percent signs, exclamation + //marks (delayed variable substitution) and double quotes with spaces and + //adds double quotes around the string. + //See: http://php.net/manual/en/function.escapeshellarg.php + if ($this->isWindows) { + $password = $this->escapeshellargCustom($this->passwd); + } $aHost = explode(':', $this->host); $dbHost = $aHost[0]; if (isset($aHost[1])) { $dbPort = $aHost[1]; $command = 'mysqldump' - . ' --user=' . $this->user - . ' --password=' . escapeshellarg($this->passwd) - . ' --host=' . $dbHost - . ' --port=' . $dbPort - . ' --opt' - . ' --skip-comments' - . ' ' . $this->dbName - . ' > ' . $outfile; + . ' --user=' . $this->user + . ' --password=' . $password + . ' --host=' . $dbHost + . ' --port=' . $dbPort + . ' --opt' + . ' --skip-comments' + . ' ' . $this->dbName + . ' > ' . $outfile; } else { $command = 'mysqldump' - . ' --host=' . $dbHost - . ' --user=' . $this->user - . ' --opt' - . ' --skip-comments' - . ' --password=' . escapeshellarg($this->passwd) - . ' ' . $this->dbName - . ' > ' . $outfile; + . ' --host=' . $dbHost + . ' --user=' . $this->user + . ' --opt' + . ' --skip-comments' + . ' --password=' . $password + . ' ' . $this->dbName + . ' > ' . $outfile; } shell_exec($command); } + /** + * string escapeshellargCustom ( string $arg , character $quotes) + * + * escapeshellarg() adds single quotes around a string and quotes/escapes any + * existing single quotes allowing you to pass a string directly to a shell + * function and having it be treated as a single safe argument. This function + * should be used to escape individual arguments to shell functions coming + * from user input. The shell functions include exec(), system() and the + * backtick operator. + * + * On Windows, escapeshellarg() instead replaces percent signs, exclamation + * marks (delayed variable substitution) and double quotes with spaces and + * adds double quotes around the string. + */ + private function escapeshellargCustom($string, $quotes = "") + { + if ($quotes === "") { + $quotes = $this->isWindows ? "\"" : "'"; + } + $n = strlen($string); + $special = ["!", "%", "\""]; + $substring = ""; + $result1 = []; + $result2 = []; + for ($i = 0; $i < $n; $i++) { + if (in_array($string[$i], $special, true)) { + $result2[] = $string[$i]; + $result1[] = $substring; + $substring = ""; + } else { + $substring = $substring . $string[$i]; + } + } + $result1[] = $substring; + //Rebuild the password string + $n = count($result1); + for ($i = 0; $i < $n; $i++) { + $result1[$i] = trim(escapeshellarg($result1[$i]), $quotes); + if (isset($result2[$i])) { + $result1[$i] = $result1[$i] . $result2[$i]; + } + } + //add simple quotes, see escapeshellarg function + $newString = $quotes . implode("", $result1) . $quotes; + return $newString; + } + /** * restoreFromSql * diff --git a/gulliver/system/class.g.php b/gulliver/system/class.g.php index cd4cf8dac..5ba76ab5a 100644 --- a/gulliver/system/class.g.php +++ b/gulliver/system/class.g.php @@ -5451,21 +5451,39 @@ class G } /** - */ + * This function save history about some actions in the file audit.log + * The data is used in the Audit Log functionality + * + * @param string $actionToLog + * @param string $valueToLog + * @return void + */ public static function auditLog($actionToLog, $valueToLog = "") { - $workspace = defined('SYS_SYS') ? SYS_SYS : 'Wokspace Undefined'; + $workspace = defined('SYS_SYS') ? SYS_SYS : 'Wokspace Undefined'; $conf = new Configurations(); $sflag = $conf->getConfiguration('AUDIT_LOG', 'log'); $sflagAudit = $sflag == 'true' ? true : false; $ipClient = G::getIpAddress(); + $userUid = 'Unknow User'; + $fullName = '-'; /*----------------------------------********---------------------------------*/ $licensedFeatures = PMLicensedFeatures::getSingleton(); if ($sflagAudit && $licensedFeatures->verifyfeature('vtSeHNhT0JnSmo1bTluUVlTYUxUbUFSVStEeXVqc1pEUG5EeXc0MGd2Q3ErYz0=')) { - $username = isset($_SESSION['USER_LOGGED']) && $_SESSION['USER_LOGGED'] != '' ? $_SESSION['USER_LOGGED'] : 'Unknow User'; - $fullname = isset($_SESSION['USR_FULLNAME']) && $_SESSION['USR_FULLNAME'] != '' ? $_SESSION['USR_FULLNAME'] : '-'; - G::log("|". $workspace ."|". $ipClient ."|". $username . "|" . $fullname ."|" . $actionToLog . "|" . $valueToLog, PATH_DATA, "audit.log"); + if (isset($_SESSION['USER_LOGGED']) && $_SESSION['USER_LOGGED'] != '') { + $userUid = $_SESSION['USER_LOGGED']; + } else { + //Get the usrUid related to the accessToken + $userUid = \ProcessMaker\Services\OAuth2\Server::getUserId(); + if (!empty($userUid)) { + $oUserLogged = new \Users(); + $user = $oUserLogged->loadDetails($userUid); + $fullName = $user['USR_FULLNAME']; + } + } + $fullName = isset($_SESSION['USR_FULLNAME']) && $_SESSION['USR_FULLNAME'] != '' ? $_SESSION['USR_FULLNAME'] : $fullName; + G::log("|". $workspace ."|". $ipClient ."|". $userUid . "|" . $fullName ."|" . $actionToLog . "|" . $valueToLog, PATH_DATA, "audit.log"); } /*----------------------------------********---------------------------------*/ } diff --git a/workflow/engine/bin/cron_single.php b/workflow/engine/bin/cron_single.php index 435da68b1..83c25f284 100644 --- a/workflow/engine/bin/cron_single.php +++ b/workflow/engine/bin/cron_single.php @@ -91,6 +91,8 @@ try { require_once('propel/Propel.php'); require_once('creole/Creole.php'); + //TODO: get rid of the global variable improving the timezone activation when this feature is enabled + global $arraySystemConfiguration; $arraySystemConfiguration = System::getSystemConfiguration('', '', $workspace); $e_all = (defined('E_DEPRECATED'))? E_ALL & ~E_DEPRECATED : E_ALL; @@ -630,7 +632,6 @@ function executeScheduledCases($sNow=null) try { global $argvx; global $sNow; - $log = array(); if ($argvx != "" && strpos($argvx, "scheduler") === false) { @@ -640,10 +641,10 @@ function executeScheduledCases($sNow=null) setExecutionMessage("Executing the scheduled starting cases"); setExecutionResultMessage('PROCESSING'); - $sNow = isset($sNow)? $sNow : date('Y-m-d H:i:s'); + $runDate = runDateForScheduledCases($sNow); $oCaseScheduler = new CaseScheduler(); - $oCaseScheduler->caseSchedulerCron($sNow, $log, 1); + $oCaseScheduler->caseSchedulerCron($runDate, $log, 1); foreach ($log as $value) { $arrayCron = unserialize(trim(@file_get_contents(PATH_DATA . "cron"))); @@ -660,6 +661,35 @@ function executeScheduledCases($sNow=null) } } +function runDateForScheduledCases($sNow) { + global $arraySystemConfiguration; + + $runDate = isset($sNow)? $sNow : date('Y-m-d H:i:s'); + + $systemUtcTimeZone = false; + /*----------------------------------********---------------------------------*/ + if (PMLicensedFeatures::getSingleton()->verifyfeature('oq3S29xemxEZXJpZEIzN01qenJUaStSekY4cTdJVm5vbWtVM0d4S2lJSS9qUT0=')) { + $systemUtcTimeZone = (int)($arraySystemConfiguration['system_utc_time_zone']) == 1; + } + /*----------------------------------********---------------------------------*/ + + if ($systemUtcTimeZone) { + if (isset($sNow)) { + //as the $sNow param that comes from the command line doesn't specicy a time zone + //we assume that the user set this time using the server time zone so we use the gmdate + //function to convert it + $currentTimeZone = date_default_timezone_get(); + date_default_timezone_set($arraySystemConfiguration['time_zone']); + $runDate = gmdate('Y-m-d H:i:s', strtotime($sNow)); + date_default_timezone_set($currentTimeZone); + } + else { + $runDate = gmdate('Y-m-d H:i:s'); + } + } + return $runDate; +} + function executeUpdateAppTitle() { try { diff --git a/workflow/engine/bin/tasks/cliWorkspaces.php b/workflow/engine/bin/tasks/cliWorkspaces.php index 556ee4d71..0e25d885b 100644 --- a/workflow/engine/bin/tasks/cliWorkspaces.php +++ b/workflow/engine/bin/tasks/cliWorkspaces.php @@ -193,11 +193,10 @@ CLI::taskRun("run_database_generate_self_service_by_value"); CLI::taskName('database-verify-consistency'); CLI::taskDescription(<<getEmailServer($dataAbe['ABE_EMAIL_SERVER_UID'], true) : $emailServer->getEmailServerDefault(); @@ -158,7 +158,13 @@ class actionsByEmailCoreClass extends PMPlugin $envSkin = defined("SYS_SKIN") ? SYS_SKIN : $conf->getConfiguration('SKIN_CRON', ''); $envHost = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : SERVER_NAME; $envProtocol = defined("REQUEST_SCHEME") && REQUEST_SCHEME === "https"; - $envPort = (SERVER_PORT . "" != "80") ? ":" . SERVER_PORT : ""; + if (isset($_SERVER['SERVER_PORT'])) { + $envPort = ($_SERVER['SERVER_PORT'] != "80") ? ":" . $_SERVER['SERVER_PORT'] : ""; + } else if (defined('SERVER_PORT')) { + $envPort = (SERVER_PORT . "" != "80") ? ":" . SERVER_PORT : ""; + } else { + $envPort = ""; // Empty by default + } if (!empty($envPort) && strpos($envHost, $envPort) === false) { $envHost = $envHost . $envPort; } diff --git a/workflow/engine/classes/class.derivation.php b/workflow/engine/classes/class.derivation.php index d5278eb8a..716954179 100644 --- a/workflow/engine/classes/class.derivation.php +++ b/workflow/engine/classes/class.derivation.php @@ -1011,28 +1011,33 @@ class Derivation case TASK_FINISH_TASK: $iAppThreadIndex = $appFields['DEL_THREAD']; $this->case->closeAppThread($currentDelegation['APP_UID'], $iAppThreadIndex); + if (isset($nextDel["TAS_UID_DUMMY"])) { + $criteria = new Criteria("workflow"); + $criteria->addSelectColumn(RoutePeer::TAS_UID); + $criteria->addJoin(RoutePeer::TAS_UID, AppDelegationPeer::TAS_UID); + $criteria->add(RoutePeer::PRO_UID, $appFields['PRO_UID']); + $criteria->add(RoutePeer::ROU_NEXT_TASK, $nextDel['ROU_PREVIOUS_TASK']); + $criteria->add(RoutePeer::ROU_TYPE, $nextDel['ROU_PREVIOUS_TYPE']); + $criteria->add(AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN'); + $rsCriteria = RoutePeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $executeEvent = ($rsCriteria->next()) ? false : true; + + $multiInstanceCompleted = true; + if ($flagTaskAssignTypeIsMultipleInstance) { + $multiInstanceCompleted = $this->case->multiInstanceIsCompleted( + $appFields['APP_UID'], + $appFields['TAS_UID'], + $appFields['DEL_PREVIOUS']); + } - if (isset($nextDel["TAS_UID_DUMMY"]) && !$flagTaskAssignTypeIsMultipleInstance) { $taskDummy = TaskPeer::retrieveByPK($nextDel["TAS_UID_DUMMY"]); if (preg_match("/^(?:END-MESSAGE-EVENT|END-EMAIL-EVENT)$/", $taskDummy->getTasType()) - && array_key_exists('ROU_PREVIOUS_TYPE', $nextDel) && $nextDel['ROU_PREVIOUS_TYPE'] !== "SEC-JOIN") { + && $multiInstanceCompleted && $executeEvent + ) { $this->executeEvent($nextDel["TAS_UID_DUMMY"], $appFields, $flagFirstIteration, true); } } - - //if the next task is an end event and the multiinstance threads are finished the end event - //is triggered: - if (isset($nextDel["TAS_UID_DUMMY"]) && $flagTaskAssignTypeIsMultipleInstance) { - $taskDummy = TaskPeer::retrieveByPK($nextDel["TAS_UID_DUMMY"]); - if ($this->case->multiInstanceIsCompleted($appFields['APP_UID'], - $appFields['TAS_UID'], - $appFields['DEL_PREVIOUS']) - && preg_match("/^(?:END-MESSAGE-EVENT|END-EMAIL-EVENT)$/", $taskDummy->getTasType())) { - $this->executeEvent($nextDel["TAS_UID_DUMMY"], $appFields, $flagFirstIteration, true); - } - } - - $this->case->closeAppThread($currentDelegation['APP_UID'], $iAppThreadIndex); $aContext['action'] = 'finish-task'; //Logger Bootstrap::registerMonolog('CaseDerivation', 200, 'Case Derivation', $aContext, $this->sysSys, 'processmaker.log'); @@ -1244,15 +1249,7 @@ class Derivation break; } - $rouPreType = ""; - $rouPreTask = ""; $taskNextDelNextDelRouType = $arrayTaskNextDelNextDel["ROU_TYPE"]; - - if(isset($arrayTaskNextDelNextDel["NEXT_TASK"]["ROU_PREVIOUS_TYPE"]) && isset($arrayTaskNextDelNextDel["NEXT_TASK"]["ROU_PREVIOUS_TASK"])){ - $rouPreType = $arrayTaskNextDelNextDel["NEXT_TASK"]["ROU_PREVIOUS_TYPE"]; - $rouPreTask = $arrayTaskNextDelNextDel["NEXT_TASK"]["ROU_PREVIOUS_TASK"]; - } - $nextDelegationsAux[++$i] = array( "TAS_UID" => $arrayTaskNextDelNextDel["NEXT_TASK"]["TAS_UID"], "USR_UID" => $arrayTaskNextDelNextDel["NEXT_TASK"]["USER_ASSIGNED"]["USR_UID"], @@ -1260,8 +1257,8 @@ class Derivation "TAS_DEF_PROC_CODE" => $arrayTaskNextDelNextDel["NEXT_TASK"]["TAS_DEF_PROC_CODE"], "DEL_PRIORITY" => "", "TAS_PARENT" => $arrayTaskNextDelNextDel["NEXT_TASK"]["TAS_PARENT"], - "ROU_PREVIOUS_TYPE" => $rouPreType, - "ROU_PREVIOUS_TASK" => $rouPreTask + "ROU_PREVIOUS_TYPE" => isset($arrayTaskNextDelNextDel["NEXT_TASK"]["ROU_PREVIOUS_TYPE"]) ? $arrayTaskNextDelNextDel["NEXT_TASK"]["ROU_PREVIOUS_TYPE"] : '', + "ROU_PREVIOUS_TASK" => isset($arrayTaskNextDelNextDel["NEXT_TASK"]["ROU_PREVIOUS_TASK"]) ? $arrayTaskNextDelNextDel["NEXT_TASK"]["ROU_PREVIOUS_TASK"] : '' ); } @@ -1609,8 +1606,8 @@ class Derivation 'TAS_DEF_PROC_CODE' => $aDeriveTask['NEXT_TASK']['TAS_DEF_PROC_CODE'], 'DEL_PRIORITY' => 3, 'TAS_PARENT' => $aDeriveTask['NEXT_TASK']['TAS_PARENT'], - 'ROU_PREVIOUS_TYPE' => $aDeriveTask['NEXT_TASK']['ROU_PREVIOUS_TYPE'], - 'ROU_PREVIOUS_TASK' => $aDeriveTask['NEXT_TASK']['ROU_PREVIOUS_TASK'] + 'ROU_PREVIOUS_TYPE' => isset($aDeriveTask['NEXT_TASK']['ROU_PREVIOUS_TYPE']) ? $aDeriveTask['NEXT_TASK']['ROU_PREVIOUS_TYPE'] : '', + 'ROU_PREVIOUS_TASK' => isset($aDeriveTask['NEXT_TASK']['ROU_PREVIOUS_TASK']) ? $aDeriveTask['NEXT_TASK']['ROU_PREVIOUS_TASK'] : '' ); } $currentDelegation2 = array( @@ -1753,7 +1750,15 @@ class Derivation } } - $nextDelegations2[] = array('TAS_UID' => $aDeriveTask['NEXT_TASK']['TAS_UID'], 'USR_UID' => $aDeriveTask['NEXT_TASK']['USER_ASSIGNED']['USR_UID'], 'TAS_ASSIGN_TYPE' => $aDeriveTask['NEXT_TASK']['TAS_ASSIGN_TYPE'], 'TAS_DEF_PROC_CODE' => $aDeriveTask['NEXT_TASK']['TAS_DEF_PROC_CODE'], 'DEL_PRIORITY' => 3, 'TAS_PARENT' => $aDeriveTask['NEXT_TASK']['TAS_PARENT'] + $nextDelegations2[] = array( + 'TAS_UID' => $aDeriveTask['NEXT_TASK']['TAS_UID'], + 'USR_UID' => $aDeriveTask['NEXT_TASK']['USER_ASSIGNED']['USR_UID'], + 'TAS_ASSIGN_TYPE' => $aDeriveTask['NEXT_TASK']['TAS_ASSIGN_TYPE'], + 'TAS_DEF_PROC_CODE' => $aDeriveTask['NEXT_TASK']['TAS_DEF_PROC_CODE'], + 'DEL_PRIORITY' => 3, + 'TAS_PARENT' => $aDeriveTask['NEXT_TASK']['TAS_PARENT'], + 'ROU_PREVIOUS_TASK' => isset($aDeriveTask['NEXT_TASK']['ROU_PREVIOUS_TASK']) ? $aDeriveTask['NEXT_TASK']['ROU_PREVIOUS_TASK'] : '', + 'ROU_PREVIOUS_TYPE' => isset($aDeriveTask['NEXT_TASK']['ROU_PREVIOUS_TYPE']) ? $aDeriveTask['NEXT_TASK']['ROU_PREVIOUS_TYPE'] : '' ); } $currentDelegation2 = array('APP_UID' => $aSA['APP_PARENT'], 'DEL_INDEX' => $aSA['DEL_INDEX_PARENT'], 'APP_STATUS' => 'TO_DO', 'TAS_UID' => $aParentCase['TAS_UID'], 'ROU_TYPE' => $aDeriveTasks[1]['ROU_TYPE'] diff --git a/workflow/engine/classes/class.patch.php b/workflow/engine/classes/class.patch.php index 75b39fa10..f19d967e0 100644 --- a/workflow/engine/classes/class.patch.php +++ b/workflow/engine/classes/class.patch.php @@ -49,7 +49,7 @@ class p11835 extends patch } return patch::$isPathchable; } - + public static function pmVersion($version) { if (preg_match("/^\D*([\d\.]+)\D*$/", $version, $matches)) { diff --git a/workflow/engine/classes/class.pluginRegistry.php b/workflow/engine/classes/class.pluginRegistry.php index 0061dcb78..69ac27afa 100644 --- a/workflow/engine/classes/class.pluginRegistry.php +++ b/workflow/engine/classes/class.pluginRegistry.php @@ -1900,22 +1900,6 @@ class PMPluginRegistry str_replace(["\n", "\r", "\t"], ' ', file_get_contents($path . $pluginFile)) ); } - - /** - * Use this for extensions - * - * @return array with namespace and plugin folder - */ - public function getEnabledPlugins() - { - $enabledPlugins = array(); - foreach ($this->_aPluginDetails as $row) { - if ($row->enabled) { - $enabledPlugins[$row->sNamespace] = $row->sPluginFolder; - } - } - return $enabledPlugins; - } /** * Registry in an array routes for js or css files. diff --git a/workflow/engine/classes/class.pmDynaform.php b/workflow/engine/classes/class.pmDynaform.php index 7df0110d1..61d0b6e4d 100644 --- a/workflow/engine/classes/class.pmDynaform.php +++ b/workflow/engine/classes/class.pmDynaform.php @@ -681,7 +681,7 @@ class pmDynaform $this->fields["APP_DATA"] = $dataGridEnvironment; $dataGridEnvironment = []; } - if (isset($this->fields["APP_DATA"][$json->name])) { + if (isset($this->fields["APP_DATA"][$json->name]) && is_array($this->fields["APP_DATA"][$json->name])) { //rows $rows = $this->fields["APP_DATA"][$json->name]; foreach ($rows as $keyRow => $row) { @@ -754,6 +754,10 @@ class pmDynaform preg_match_all('/\@(?:([\@\%\#\=\!Qq])([a-zA-Z\_]\w*)|([a-zA-Z\_][\w\-\>\:]*)\(((?:[^\\\\\)]*?)*)\))/', $json->sql, $result, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE); $variables = isset($result[2]) ? $result[2] : array(); foreach ($variables as $key => $value) { + //Prevents an infinite cycle. If the name of the variable is used within its own dependent. + if ($value[0] === $json->variable) { + continue; + } $jsonSearch = $this->jsonsf(G::json_decode($this->record["DYN_CONTENT"]), $value[0], $json->variable === "" ? "id" : "variable"); $a = $this->getValuesDependentFields($jsonSearch); foreach ($a as $i => $v) { @@ -823,6 +827,9 @@ class pmDynaform public function getDatabaseProvider($dbConnection) { + if ($dbConnection === "workflow" || $dbConnection === "rbac" || $dbConnection === "rp") { + return "mysql"; + } if ($this->databaseProviders === null) { $a = new Criteria("workflow"); $a->addSelectColumn(DbSourcePeer::DBS_UID); @@ -926,8 +933,7 @@ class pmDynaform $where = ""; if (!empty($parsed["WHERE"])) { $where = "WHERE "; - $dt = ($parsed['WHERE'][0]['expr_type'] == 'expression') ? $parsed['WHERE'][0]['sub_tree'] : - $parsed["WHERE"]; + $dt = ($parsed['WHERE'][0]['expr_type'] == 'expression') ? $parsed['WHERE'][0]['sub_tree'] : $parsed["WHERE"]; $nw = count($dt); //reserved word: OFFSET if ($dt[$nw - 2]["base_expr"] === "OFFSET") { @@ -953,7 +959,8 @@ class pmDynaform $groupBy = "GROUP BY "; $dt = $parsed["GROUP"]; foreach ($dt as $key => $value) { - $groupBy .= $value["base_expr"] . ", "; + $search = preg_replace("/ ASC$/i", "", $value["base_expr"]); + $groupBy .= $search . ", "; } $groupBy = rtrim($groupBy, ", "); } @@ -974,10 +981,10 @@ class pmDynaform $orderBy = "ORDER BY "; $dt = $parsed["ORDER"]; foreach ($dt as $key => $value) { - $orderBy .= $value["base_expr"] . ", "; + $search = preg_replace("/ ASC$/i", "", $value["base_expr"]); + $orderBy .= $search . " " . $value["direction"] . ", "; } $orderBy = rtrim($orderBy, ", "); - $orderBy .= " " . $value["direction"]; } $orderBy = trim($orderBy); diff --git a/workflow/engine/classes/class.pmFunctions.php b/workflow/engine/classes/class.pmFunctions.php index c608d430b..40b00348f 100644 --- a/workflow/engine/classes/class.pmFunctions.php +++ b/workflow/engine/classes/class.pmFunctions.php @@ -2533,7 +2533,7 @@ function PMFRedirectToStep ($sApplicationUID, $iDelegation, $sStepType, $sStepUi * Returns a list of the next assigned users to a case. * * @name PMFGetNextAssignedUser - * @label PMFGet Next Assigned User + * @label PMF Get Next Assigned User * * @param string(32) | $application | Case ID | Id of the case * @param string(32) | $task | Task ID | Id of the task @@ -2598,7 +2598,7 @@ function PMFGetNextAssignedUser ($application, $task, $delIndex = null, $userUid * @label PMF Get User Email Address * @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#PMFGetUserEmailAddress.28.29 * - * @param string(32) or Array | $id | Case ID | Id of the case. + * @param string(32) or Array | $id | List of Recipients | which can be a mixture of user IDs, group IDs, variable names or email addresses * @param string(32) | $APP_UID = null | Application ID | Id of the Application. * @param string(32) | $prefix = "usr" | prefix | Id of the task. * @return array | $aRecipient | Array of the Recipient | Return an Array of the Recipient. @@ -3125,7 +3125,7 @@ function PMFGeti18nText($id, $category, $lang = "en") * @method * The requested text in the specified language | If not found returns false * @name PMFUnCancelCase - * @label PMF Un Cancel Case + * @label PMF Restore Case * @param string | $caseUID | ID Case | Is the unique UID of the case * @param string | $userUID | ID User | Is the unique ID of the user who will uncancel the case * @return int | $value | Return | Returns 1 if the case was successfully uncancelled, otherwise returns 0 if an error ocurred diff --git a/workflow/engine/classes/class.processes.php b/workflow/engine/classes/class.processes.php index c39c52a81..bddf3ec7b 100644 --- a/workflow/engine/classes/class.processes.php +++ b/workflow/engine/classes/class.processes.php @@ -5686,6 +5686,14 @@ class Processes return $oData; } + /** + * @param $modelClass + * @param $uidTableField + * @param $idTableField + * @param $data + * @return array + * @throws Exception + */ private function loadIdsFor($modelClass, $uidTableField, $idTableField, &$data) { @@ -5693,7 +5701,7 @@ class Processes return $data; } if (!is_array($data)) { - throw new Exception("Invalid input data form $modelClass($key)".G::json_encode($data)); + throw new Exception("Invalid input data form $modelClass($key)" . G::json_encode($data)); } $uidTableFieldArray = explode('.', $uidTableField); $idTableFieldArray = explode('.', $idTableField); @@ -5707,17 +5715,19 @@ class Processes $idField = $idTableFieldArray[1]; if (isset($data[$uidField])) { //$data is an single row - $model = new $modelClass(); - $row = $model->load($data[$uidField]); - $data[$idField] = $model->getByName($idTableField, - BasePeer::TYPE_COLNAME); + $modelPeer = $modelClass . 'Peer'; + $oRow = $modelPeer::retrieveByPK($data[$uidField]); + if (!is_null($oRow)) { + $data[$idField] = $oRow->getByName($idTableField, BasePeer::TYPE_COLNAME); + } } else { //$data is an array of row foreach ($data as $i => $dataRow) { - $model = new $modelClass(); - $row = $model->load($dataRow[$uidField]); - $data[$i][$idField] = $model->getByName($idTableField, - BasePeer::TYPE_COLNAME); + $modelPeer = $modelClass . 'Peer'; + $oRow = $modelPeer::retrieveByPK($dataRow[$uidField]); + if (!is_null($oRow)) { + $data[$i][$idField] = $oRow->getByName($idTableField, BasePeer::TYPE_COLNAME); + } } } return $data; diff --git a/workflow/engine/classes/class.wsBase.php b/workflow/engine/classes/class.wsBase.php index 7744da3b3..7399e15bc 100644 --- a/workflow/engine/classes/class.wsBase.php +++ b/workflow/engine/classes/class.wsBase.php @@ -2156,10 +2156,74 @@ class wsBase return $result; } } + /** + * Execute the trigger defined in the steps + * This function is used when the case is derived from abe, Soap, PMFDerivateCase + * + * @param array $appData contain all the information about the case + * @param string $tasUid + * @param string $stepType + * @param string $stepUidObj + * @param string $triggerType + * @param string $labelAssigment + * @return string $varTriggers + */ + function executeTriggerFromDerivate($appData, $tasUid, $stepType, $stepUidObj, $triggerType, $labelAssigment = '') + { + $varTriggers = ""; + $oCase = new Cases(); + + //Execute triggers before assignment + $aTriggers = $oCase->loadTriggers($tasUid, $stepType, $stepUidObj, $triggerType); + + if (count( $aTriggers ) > 0) { + $varTriggers = $varTriggers . "
".$labelAssigment."
"; + + $oPMScript = new PMScript(); + + foreach ($aTriggers as $aTrigger) { + //Set variables + $params = new stdClass(); + $params->appData = $appData; + + if ($this->stored_system_variables) { + $params->option = "STORED SESSION"; + $params->SID = $this->wsSessionId; + } + + $appFields["APP_DATA"] = array_merge($appData, G::getSystemConstants($params)); + + //PMScript + $oPMScript->setFields( $appFields['APP_DATA'] ); + $bExecute = true; + + if ($aTrigger['ST_CONDITION'] !== '') { + $oPMScript->setScript( $aTrigger['ST_CONDITION'] ); + $bExecute = $oPMScript->evaluate(); + } + + if ($bExecute) { + $oPMScript->setScript( $aTrigger['TRI_WEBBOT'] ); + $oPMScript->execute(); + + $trigger = TriggersPeer::retrieveByPk($aTrigger["TRI_UID"]); + $varTriggers = $varTriggers . " - " . nl2br(htmlentities($trigger->getTriTitle(), ENT_QUOTES)) . "
"; + + $appFields['APP_DATA'] = $oPMScript->aFields; + unset($appFields['APP_STATUS']); + unset($appFields['APP_PROC_STATUS']); + unset($appFields['APP_PROC_CODE']); + unset($appFields['APP_PIN']); + $oCase->updateCase($caseId, $appFields); + } + } + } + return $varTriggers; + } /** - * derivate Case moves the case to the next task in the process according to the routing rules - * + * Derivate Case moves the case to the next task in the process according to the routing rules + * This function is used from: action by email, web entry, PMFDerivateCase, Mobile * @param string $userId * @param string $caseId * @param string $delIndex @@ -2178,10 +2242,10 @@ class wsBase $_SESSION["INDEX"] = $delIndex; $_SESSION["USER_LOGGED"] = $userId; + //Define variables $sStatus = 'TO_DO'; - $varResponse = ''; - $varTriggers = "\n"; + $previousAppData = array(); if ($delIndex == '') { $oCriteria = new Criteria( 'workflow' ); @@ -2216,18 +2280,10 @@ class wsBase return $result; } - $oCriteria = new Criteria( 'workflow' ); - $oCriteria->addSelectColumn( AppDelayPeer::APP_UID ); - $oCriteria->addSelectColumn( AppDelayPeer::APP_DEL_INDEX ); - $oCriteria->add( AppDelayPeer::APP_TYPE, '' ); - $oCriteria->add( $oCriteria->getNewCriterion( AppDelayPeer::APP_TYPE, 'PAUSE' )->addOr( $oCriteria->getNewCriterion( AppDelayPeer::APP_TYPE, 'CANCEL' ) ) ); - $oCriteria->addAscendingOrderByColumn( AppDelayPeer::APP_ENABLE_ACTION_DATE ); - $oDataset = AppDelayPeer::doSelectRS( $oCriteria ); - $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); - $oDataset->next(); - $aRow = $oDataset->getRow(); - - if (is_array( $aRow )) { + //Validate if the case is paused or cancelled + $oAppDelay = new AppDelay(); + $aRow = $oAppDelay->getCasesCancelOrPaused($caseId); + if (is_array($aRow)) { if (isset( $aRow['APP_DISABLE_ACTION_USER'] ) && $aRow['APP_DISABLE_ACTION_USER'] != 0 && isset( $aRow['APP_DISABLE_ACTION_DATE'] ) && $aRow['APP_DISABLE_ACTION_DATE'] != '') { $result = new wsResponse( 19, G::LoadTranslation( 'ID_CASE_IN_STATUS' ) . " " . $aRow['APP_TYPE'] ); @@ -2258,101 +2314,18 @@ class wsBase global $oPMScript; + if (isset($oPMScript->aFields['APPLICATION']) && ($oPMScript->aFields['APPLICATION'] != $caseId)) { + $previousAppData = $oPMScript->aFields; + } + + $varTriggers = "\n"; + //Execute triggers before assignment if ($bExecuteTriggersBeforeAssignment) { - //Execute triggers before assignment - $aTriggers = $oCase->loadTriggers( $appdel['TAS_UID'], 'ASSIGN_TASK', - 1, 'BEFORE' ); - - if (count( $aTriggers ) > 0) { - $varTriggers = $varTriggers . "
-= Before Assignment =-
"; - - $oPMScript = new PMScript(); - - foreach ($aTriggers as $aTrigger) { - //Set variables - $params = new stdClass(); - $params->appData = $appFields["APP_DATA"]; - - if ($this->stored_system_variables) { - $params->option = "STORED SESSION"; - $params->SID = $this->wsSessionId; - } - - $appFields["APP_DATA"] = array_merge( $appFields["APP_DATA"], G::getSystemConstants( $params ) ); - - //PMScript - $oPMScript->setFields( $appFields['APP_DATA'] ); - $bExecute = true; - - if ($aTrigger['ST_CONDITION'] !== '') { - $oPMScript->setScript( $aTrigger['ST_CONDITION'] ); - $bExecute = $oPMScript->evaluate(); - } - - if ($bExecute) { - $oPMScript->setScript( $aTrigger['TRI_WEBBOT'] ); - $oPMScript->execute(); - - $trigger = TriggersPeer::retrieveByPk($aTrigger["TRI_UID"]); - $varTriggers = $varTriggers . " - " . nl2br(htmlentities($trigger->getTriTitle(), ENT_QUOTES)) . "
"; - - //$appFields = $oCase->loadCase( $caseId ); - $appFields['APP_DATA'] = $oPMScript->aFields; - unset($appFields['APP_STATUS']); - unset($appFields['APP_PROC_STATUS']); - unset($appFields['APP_PROC_CODE']); - unset($appFields['APP_PIN']); - $oCase->updateCase( $caseId, $appFields ); - } - } - } + $varTriggers .= $this->executeTriggerFromDerivate($appFields["APP_DATA"], $appdel['TAS_UID'], 'ASSIGN_TASK', -1, 'BEFORE', "-= Before Assignment =-"); } - //Execute triggers before derivation BEFORE_ROUTING - $aTriggers = $oCase->loadTriggers( $appdel['TAS_UID'], 'ASSIGN_TASK', - 2, 'BEFORE' ); - - if (count( $aTriggers ) > 0) { - $varTriggers .= "-= Before Derivation =-
"; - - $oPMScript = new PMScript(); - - foreach ($aTriggers as $aTrigger) { - //Set variables - $params = new stdClass(); - $params->appData = $appFields["APP_DATA"]; - - if ($this->stored_system_variables) { - $params->option = "STORED SESSION"; - $params->SID = $this->wsSessionId; - } - - $appFields["APP_DATA"] = array_merge( $appFields["APP_DATA"], G::getSystemConstants( $params ) ); - - //PMScript - $oPMScript->setFields( $appFields['APP_DATA'] ); - $bExecute = true; - - if ($aTrigger['ST_CONDITION'] !== '') { - $oPMScript->setScript( $aTrigger['ST_CONDITION'] ); - $bExecute = $oPMScript->evaluate(); - } - - if ($bExecute) { - $oPMScript->setScript( $aTrigger['TRI_WEBBOT'] ); - $oPMScript->execute(); - - $oTrigger = TriggersPeer::retrieveByPk( $aTrigger['TRI_UID'] ); - $varTriggers .= " - " . nl2br( htmlentities( $oTrigger->getTriTitle(), ENT_QUOTES ) ) . "
"; - //$appFields = $oCase->loadCase( $caseId ); - $appFields['APP_DATA'] = $oPMScript->aFields; - unset($appFields['APP_STATUS']); - unset($appFields['APP_PROC_STATUS']); - unset($appFields['APP_PROC_CODE']); - unset($appFields['APP_PIN']); - //$appFields['APP_DATA']['APPLICATION'] = $caseId; - $oCase->updateCase( $caseId, $appFields ); - } - } - } + //Execute triggers before routing + $varTriggers .= $this->executeTriggerFromDerivate($appFields["APP_DATA"], $appdel['TAS_UID'], 'ASSIGN_TASK', -2, 'BEFORE', "-= Before Derivation =-"); $oDerivation = new Derivation(); if (!empty($tasks)) { @@ -2396,8 +2369,8 @@ class wsBase $nodeNext['TAS_DEF_PROC_CODE'] = $val['NEXT_TASK']['TAS_DEF_PROC_CODE']; $nodeNext['DEL_PRIORITY'] = $appdel['DEL_PRIORITY']; $nodeNext['TAS_PARENT'] = $val['NEXT_TASK']['TAS_PARENT']; - $nodeNext['ROU_CONDITION'] = $val['ROU_CONDITION']; - + $nodeNext['ROU_PREVIOUS_TYPE'] = (isset($val['NEXT_TASK']['ROU_PREVIOUS_TYPE'])) ? $val['NEXT_TASK']['ROU_PREVIOUS_TYPE'] : ''; + $nodeNext['ROU_PREVIOUS_TASK'] = (isset($val['NEXT_TASK']['ROU_PREVIOUS_TASK'])) ? $val['NEXT_TASK']['ROU_PREVIOUS_TASK'] : ''; $nextDelegations[] = $nodeNext; $varResponse = $varResponse . (($varResponse != '') ? ',' : '') . $val['NEXT_TASK']['TAS_TITLE'] . $usrasgdUserName; } @@ -2408,27 +2381,26 @@ class wsBase $appFields['TAS_UID'] = $derive['TAS_UID']; } - $row = array (); - $oCriteria = new Criteria( 'workflow' ); - $del = DBAdapter::getStringDelimiter(); - $oCriteria->addSelectColumn( RoutePeer::ROU_TYPE ); - $oCriteria->addSelectColumn( RoutePeer::ROU_NEXT_TASK ); - $oCriteria->add( RoutePeer::TAS_UID, $appdel['TAS_UID'] ); - $oDataset = TaskPeer::doSelectRS( $oCriteria ); - $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); - $oDataset->next(); - - while ($aRow = $oDataset->getRow()) { - $row[] = array('ROU_TYPE' => $aRow['ROU_TYPE'], 'ROU_NEXT_TASK' => $aRow['ROU_NEXT_TASK']); - $oDataset->next(); - } + //Get from the route information the nextTask + $nextTaskUid = $appdel['TAS_UID']; + $nextRouteType = ''; + do { + $oRoute = new \Route(); + $nextRouteTask = $oRoute->getNextRouteByTask($nextTaskUid); + $prefix = ''; + if (isset($nextRouteTask['ROU_NEXT_TASK'])) { + $nextTaskUid = $nextRouteTask['ROU_NEXT_TASK']; + $nextRouteType = $nextRouteTask['ROU_TYPE']; + $prefix = substr($nextTaskUid, 0, 4); + } + } while ($prefix == 'gtg-'); $aCurrentDerivation = array ( 'APP_UID' => $caseId, 'DEL_INDEX' => $delIndex, 'APP_STATUS' => $sStatus, 'TAS_UID' => $appdel['TAS_UID'], - 'ROU_TYPE' => $row[0]['ROU_TYPE'] + 'ROU_TYPE' => $nextRouteType ); //We define some parameters in the before the derivation @@ -2436,66 +2408,19 @@ class wsBase $oDerivation->beforeDerivate( $aData, $nextDelegations, - $row[0]['ROU_TYPE'], + $nextRouteType, $aCurrentDerivation ); $appFields = $oCase->loadCase( $caseId ); - //Execute triggers after derivation - $aTriggers = $oCase->loadTriggers( $appdel['TAS_UID'], 'ASSIGN_TASK', - 2, 'AFTER' ); - - if (count( $aTriggers ) > 0) { - - //Set variables - $params = new stdClass(); - $params->appData = $appFields["APP_DATA"]; - - if ($this->stored_system_variables) { - $params->option = "STORED SESSION"; - $params->SID = $this->wsSessionId; - } - - $appFields["APP_DATA"] = array_merge( $appFields["APP_DATA"], G::getSystemConstants( $params ) ); - - //PMScript - $oPMScript = new PMScript(); - $oPMScript->setFields( $appFields['APP_DATA'] ); - - $varTriggers .= "-= After Derivation =-
"; - - foreach ($aTriggers as $aTrigger) { - $bExecute = true; - - if ($aTrigger['ST_CONDITION'] !== '') { - $oPMScript->setScript( $aTrigger['ST_CONDITION'] ); - $bExecute = $oPMScript->evaluate(); - } - - if ($bExecute) { - $oPMScript->setScript( $aTrigger['TRI_WEBBOT'] ); - $oPMScript->execute(); - - $oTrigger = TriggersPeer::retrieveByPk( $aTrigger['TRI_UID'] ); - $varTriggers .= " - " . nl2br( htmlentities( $oTrigger->getTriTitle(), ENT_QUOTES ) ) . "
"; - //$appFields = $oCase->loadCase($caseId); - $appFields['APP_DATA'] = $oPMScript->aFields; - //$appFields['APP_DATA']['APPLICATION'] = $caseId; - //$appFields = $oCase->loadCase($caseId); - unset($appFields['APP_STATUS']); - unset($appFields['APP_PROC_STATUS']); - unset($appFields['APP_PROC_CODE']); - unset($appFields['APP_PIN']); - $oCase->updateCase( $caseId, $appFields ); - } - } - } + //Execute triggers after routing + $varTriggers .= $this->executeTriggerFromDerivate($appFields["APP_DATA"], $appdel['TAS_UID'], 'ASSIGN_TASK', -2, 'AFTER', "-= After Derivation =-"); $sFromName = ""; if ($userId != "") { $user = new Users(); - $arrayUserData = $user->load($userId); if (trim($arrayUserData["USR_EMAIL"]) == "") { @@ -2507,15 +2432,9 @@ class wsBase $oCase->sendNotifications( $appdel['TAS_UID'], $nextDelegations, $appFields['APP_DATA'], $caseId, $delIndex, $sFromName ); - //Save data - Start - //$appFields = $oCase->loadCase($caseId); - //$oCase->updateCase($caseId, $appFields); - //Save data - End - - $oProcess = new Process(); $oProcessFieds = $oProcess->Load( $appFields['PRO_UID'] ); - //here dubug mode in web entry + //here debug mode in web entry if (isset( $oProcessFieds['PRO_DEBUG'] ) && $oProcessFieds['PRO_DEBUG']) { @@ -2528,7 +2447,7 @@ class wsBase $res = $result->getPayloadArray(); - //now fill the array of AppDelegationPeer + //Now fill the array of AppDelegationPeer $oCriteria = new Criteria( 'workflow' ); $oCriteria->addSelectColumn( AppDelegationPeer::DEL_INDEX ); $oCriteria->addSelectColumn( AppDelegationPeer::USR_UID ); @@ -2546,7 +2465,6 @@ class wsBase while ($oDataset->next()) { $aAppDel = $oDataset->getRow(); - $oUser = new Users(); try { @@ -2566,7 +2484,7 @@ class wsBase $taskName = ''; } - // execute events + //Execute events $eventPro = $_SESSION["PROCESS"]; $eventApp = $caseId; $eventInd = $aAppDel['DEL_INDEX']; @@ -2574,8 +2492,7 @@ class wsBase $oEvent = new Event(); $oEvent->createAppEvents( $eventPro, $eventApp, $eventInd, $eventTas ); - // end events - + //End events $currentUser = new stdClass(); $currentUser->userId = $aAppDel['USR_UID']; @@ -2592,6 +2509,10 @@ class wsBase $g->sessionVarRestore(); + if (!empty($previousAppData)) { + $oPMScript->aFields = $previousAppData; + } + return $res; } catch (Exception $e) { $result = new wsResponse( 100, $e->getMessage() ); diff --git a/workflow/engine/classes/class.wsTools.php b/workflow/engine/classes/class.wsTools.php index 34a01bba6..6dfcfddd0 100644 --- a/workflow/engine/classes/class.wsTools.php +++ b/workflow/engine/classes/class.wsTools.php @@ -5,7 +5,9 @@ * * @author Alexandre Rosenfeld */ - +G::LoadSystem('dbMaintenance'); +G::LoadClass("cli"); +G::LoadClass("multipleFilesBackup"); /** * class workspaceTools * @@ -143,6 +145,13 @@ class workspaceTools $final = $stop - $start; CLI::logging("<*> Check Mafe Requirements Process took $final seconds.\n"); + $start = microtime(true); + CLI::logging("> Updating Triggers...\n"); + $this->updateTriggers(true, $lang); + $stop = microtime(true); + $final = $stop - $start; + CLI::logging("<*> Updating Triggers Process took $final seconds.\n"); + $start = microtime(true); CLI::logging("> Backup log files...\n"); $this->backupLogFiles(); @@ -2579,10 +2588,10 @@ class workspaceTools LEFT JOIN ' . $this->dbName . '.USERS ON CUR_USER.USR_UID = USERS.USR_UID LEFT JOIN ' . $this->dbName . '.TASK ON CUR_USER.TAS_UID = TASK.TAS_UID) USERS_VALUES SET - LPL.DEL_CURRENT_USR_USERNAME = USERS_VALUES.USR_USERNAME, - LPL.DEL_CURRENT_USR_FIRSTNAME = USERS_VALUES.USR_FIRSTNAME, - LPL.DEL_CURRENT_USR_LASTNAME = USERS_VALUES.USR_LASTNAME, - LPL.DEL_CURRENT_TAS_TITLE = USERS_VALUES.TAS_TITLE + LPL.DEL_CURRENT_USR_USERNAME = IFNULL(USERS_VALUES.USR_USERNAME, \'\'), + LPL.DEL_CURRENT_USR_FIRSTNAME = IFNULL(USERS_VALUES.USR_FIRSTNAME, \'\'), + LPL.DEL_CURRENT_USR_LASTNAME = IFNULL(USERS_VALUES.USR_LASTNAME, \'\'), + LPL.DEL_CURRENT_TAS_TITLE = IFNULL(USERS_VALUES.TAS_TITLE, \'\') WHERE LPL.APP_UID = USERS_VALUES.APP_UID'; $con = Propel::getConnection("workflow"); $stmt = $con->createStatement(); @@ -2601,6 +2610,7 @@ class workspaceTools $delaycriteria->addSelectColumn(AppCacheViewPeer::USR_UID); $delaycriteria->addSelectColumn(AppCacheViewPeer::APP_STATUS); $delaycriteria->addSelectColumn(AppCacheViewPeer::TAS_UID); + $delaycriteria->addSelectColumn(AppCacheViewPeer::DEL_DELEGATE_DATE); $delaycriteria->addJoin( AppCacheViewPeer::APP_UID, AppDelayPeer::APP_UID . ' AND ' . AppCacheViewPeer::DEL_INDEX . ' = ' . AppDelayPeer::APP_DEL_INDEX, Criteria::INNER_JOIN ); $delaycriteria->add(AppDelayPeer::APP_DISABLE_ACTION_USER, "0", CRITERIA::EQUAL); @@ -3772,4 +3782,14 @@ class workspaceTools } } + /** + * Updating triggers + * @param $flagRecreate + * @param $lang + */ + public function updateTriggers($flagRecreate, $lang) + { + $this->initPropel(true); + $this->upgradeTriggersOfTables($flagRecreate, $lang); + } } diff --git a/workflow/engine/classes/model/AppDelay.php b/workflow/engine/classes/model/AppDelay.php index 56a4e5179..d2aa9dc85 100644 --- a/workflow/engine/classes/model/AppDelay.php +++ b/workflow/engine/classes/model/AppDelay.php @@ -112,5 +112,25 @@ class AppDelay extends BaseAppDelay return false; } } + + /** + * Verify if the case is Paused or cancelled + * + * @param $appUid string + * @return $oDataset array + */ + public function getCasesCancelOrPaused($appUid) + { + $oCriteria = new Criteria( 'workflow' ); + $oCriteria->addSelectColumn( AppDelayPeer::APP_UID ); + $oCriteria->addSelectColumn( AppDelayPeer::APP_DEL_INDEX ); + $oCriteria->add( AppDelayPeer::APP_UID, $appUid ); + $oCriteria->add( $oCriteria->getNewCriterion( AppDelayPeer::APP_TYPE, 'PAUSE' )->addOr( $oCriteria->getNewCriterion( AppDelayPeer::APP_TYPE, 'CANCEL' ) ) ); + $oCriteria->addAscendingOrderByColumn( AppDelayPeer::APP_ENABLE_ACTION_DATE ); + $oDataset = AppDelayPeer::doSelectRS( $oCriteria ); + $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $oDataset->next(); + return $oDataset->getRow(); + } } diff --git a/workflow/engine/classes/model/AppDocument.php b/workflow/engine/classes/model/AppDocument.php index a3e326d75..7e9eb6075 100644 --- a/workflow/engine/classes/model/AppDocument.php +++ b/workflow/engine/classes/model/AppDocument.php @@ -369,7 +369,7 @@ class AppDocument extends BaseAppDocument if ($sValue !== null && ! is_string( $sValue )) { $sValue = (string) $sValue; } - if ($this->app_doc_title !== $sValue || $sValue === '') { + if (in_array(AppDocumentPeer::APP_DOC_TITLE, $this->modifiedColumns) || $sValue === '') { try { $this->app_doc_title = $sValue; $iResult = Content::addContent( 'APP_DOC_TITLE', $this->getDocVersion(), $this->getAppDocUid(), (defined( 'SYS_LANG' ) ? SYS_LANG : 'en'), $this->app_doc_title ); @@ -411,7 +411,7 @@ class AppDocument extends BaseAppDocument if ($sValue !== null && ! is_string( $sValue )) { $sValue = (string) $sValue; } - if ($this->app_doc_comment !== $sValue || $sValue === '') { + if (in_array(AppDocumentPeer::APP_DOC_COMMENT, $this->modifiedColumns) || $sValue === '') { try { $this->app_doc_comment = $sValue; $iResult = Content::addContent( 'APP_DOC_COMMENT', $this->getDocVersion(), $this->getAppDocUid(), (defined( 'SYS_LANG' ) ? SYS_LANG : 'en'), $this->app_doc_comment ); @@ -453,7 +453,7 @@ class AppDocument extends BaseAppDocument if ($sValue !== null && ! is_string( $sValue )) { $sValue = (string) $sValue; } - if ($this->app_doc_filename !== $sValue || $sValue === '') { + if (in_array(AppDocumentPeer::APP_DOC_FILENAME, $this->modifiedColumns) || $sValue === '') { try { $this->app_doc_filename = $sValue; $iResult = Content::addContent( 'APP_DOC_FILENAME', $this->getDocVersion(), $this->getAppDocUid(), (defined( 'SYS_LANG' ) ? SYS_LANG : 'en'), $this->app_doc_filename ); diff --git a/workflow/engine/classes/model/Application.php b/workflow/engine/classes/model/Application.php index 9fad21d8a..1159ea10e 100644 --- a/workflow/engine/classes/model/Application.php +++ b/workflow/engine/classes/model/Application.php @@ -89,7 +89,7 @@ class Application extends BaseApplication $v = (string) $v; } - if ($this->app_title_content !== $v || $v === '') { + if (in_array(ApplicationPeer::APP_TITLE, $this->modifiedColumns) || $v === '') { $this->app_title_content = $v; $lang = defined('SYS_LANG')? SYS_LANG : 'en'; $res = Content::addContent('APP_TITLE', '', $this->getAppUid(), $lang, $this->app_title_content); @@ -130,7 +130,7 @@ class Application extends BaseApplication $v = (string) $v; } - if ($this->app_description_content !== $v || $v === '') { + if (in_array(ApplicationPeer::APP_DESCRIPTION, $this->modifiedColumns) || $v === '') { $this->app_description_content = $v; $lang = defined('SYS_LANG')? SYS_LANG : 'en'; $res = Content::addContent('APP_DESCRIPTION', '', $this->getAppUid(), $lang, $this->app_description_content); @@ -252,14 +252,11 @@ class Application extends BaseApplication if ($this->validate()) { $con->begin(); - $res = $this->save(); - $con->commit(); - $this->setAppTitleContent('#' . $maxNumber); $this->setAppDescriptionContent(''); //to do: ID_CASE in translation $this->setAppTitle(G::LoadTranslation('ID_CASE') . $maxNumber); //Content::insertContent('APP_PROC_CODE', '', $this->getAppUid(), $lang, ''); - + $res = $this->save(); $con->commit(); return $this->getAppUid(); diff --git a/workflow/engine/classes/model/Department.php b/workflow/engine/classes/model/Department.php index 2661f00b4..7c11bde98 100644 --- a/workflow/engine/classes/model/Department.php +++ b/workflow/engine/classes/model/Department.php @@ -167,7 +167,7 @@ class Department extends BaseDepartment $v = (string) $v; } - if ($this->depo_title !== $v || $v === '') { + if (in_array(DepartmentPeer::DEP_TITLE, $this->modifiedColumns) || $v === '') { $this->depo_title = $v; $lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en'; $res = Content::addContent( 'DEPO_TITLE', '', $this->getDepUid(), $lang, $this->depo_title ); diff --git a/workflow/engine/classes/model/Dynaform.php b/workflow/engine/classes/model/Dynaform.php index d60f63763..b5d0e8927 100644 --- a/workflow/engine/classes/model/Dynaform.php +++ b/workflow/engine/classes/model/Dynaform.php @@ -82,7 +82,7 @@ class Dynaform extends BaseDynaform $v = (string) $v; } - if ($this->dyn_title_content !== $v || $v === '') { + if (in_array(DynaformPeer::DYN_TITLE, $this->modifiedColumns) || $v === '') { $this->dyn_title_content = $v; $lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en'; @@ -131,7 +131,7 @@ class Dynaform extends BaseDynaform $v = (string) $v; } - if ($this->dyn_description !== $v || $v === '') { + if (in_array(DynaformPeer::DYN_DESCRIPTION, $this->modifiedColumns) || $v === '') { $this->dyn_description = $v; $lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en'; @@ -209,9 +209,9 @@ class Dynaform extends BaseDynaform $this->setDynVersion( $aData['DYN_VERSION'] ); if ($this->validate()) { $con->begin(); - $res = $this->save(); $this->setDynTitleContent( $dynTitle ); $this->setDynDescriptionContent( $dynDescription ); + $res = $this->save(); $con->commit(); //Add Audit Log diff --git a/workflow/engine/classes/model/Groupwf.php b/workflow/engine/classes/model/Groupwf.php index 888c176d8..dd2d826e1 100644 --- a/workflow/engine/classes/model/Groupwf.php +++ b/workflow/engine/classes/model/Groupwf.php @@ -60,7 +60,8 @@ class Groupwf extends BaseGroupwf $v = (string) $v; } - if ($this->grp_title_content !== $v || $v === '') { + if (in_array(GroupwfPeer::GRP_TITLE, $this->modifiedColumns) !== $v || $v + === '') { $this->grp_title_content = $v; $lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en'; $res = Content::addContent( 'GRP_TITLE', '', $this->getGrpUid(), $lang, $this->grp_title_content ); @@ -105,14 +106,12 @@ class Groupwf extends BaseGroupwf if ($this->validate()) { $con->begin(); - $res = $this->save(); - if (isset( $aData['GRP_TITLE'] )) { $this->setGrpTitleContent( $aData['GRP_TITLE'] ); } else { $this->setGrpTitleContent( 'Default Group Title' ); } - + $res = $this->save(); $con->commit(); return $this->getGrpUid(); } else { diff --git a/workflow/engine/classes/model/InputDocument.php b/workflow/engine/classes/model/InputDocument.php index 1556a6ff7..e990e5308 100644 --- a/workflow/engine/classes/model/InputDocument.php +++ b/workflow/engine/classes/model/InputDocument.php @@ -316,7 +316,7 @@ class InputDocument extends BaseInputDocument if ($sValue !== null && ! is_string( $sValue )) { $sValue = (string) $sValue; } - if ($this->inp_doc_title_content !== $sValue || $sValue === '') { + if (in_array(InputDocumentPeer::INP_DOC_TITLE, $this->modifiedColumns) || $sValue === '') { try { $this->inp_doc_title_content = $sValue; @@ -356,7 +356,7 @@ class InputDocument extends BaseInputDocument if ($sValue !== null && ! is_string( $sValue )) { $sValue = (string) $sValue; } - if ($this->inp_doc_description_content !== $sValue || $sValue === '') { + if (in_array(InputDocumentPeer::INP_DOC_DESCRIPTION, $this->modifiedColumns) || $sValue === '') { try { $this->inp_doc_description_content = $sValue; diff --git a/workflow/engine/classes/model/ListCanceled.php b/workflow/engine/classes/model/ListCanceled.php index e9e521340..c01224f16 100644 --- a/workflow/engine/classes/model/ListCanceled.php +++ b/workflow/engine/classes/model/ListCanceled.php @@ -99,6 +99,9 @@ class ListCanceled extends BaseListCanceled $oListInbox = new ListInbox(); $oListInbox->removeAll($data['APP_UID']); + //We need to remove the cancelled case from unassigned list if the record exists + $unassigned = new ListUnassigned(); + $unassigned->remove($data['APP_UID'], $data['DEL_INDEX']); //Update - WHERE $criteriaWhere = new Criteria("workflow"); diff --git a/workflow/engine/classes/model/OutputDocument.php b/workflow/engine/classes/model/OutputDocument.php index 40241b448..f11cab900 100644 --- a/workflow/engine/classes/model/OutputDocument.php +++ b/workflow/engine/classes/model/OutputDocument.php @@ -364,8 +364,7 @@ class OutputDocument extends BaseOutputDocument if ($sValue !== null && !is_string($sValue)) { $sValue = (string) $sValue; } - - if ($this->out_doc_title !== $sValue || $sValue === '') { + if (in_array(OutputDocumentPeer::OUT_DOC_TITLE, $this->modifiedColumns) || $sValue === '') { try { $this->out_doc_title = $sValue; @@ -411,7 +410,7 @@ class OutputDocument extends BaseOutputDocument $sValue = (string) $sValue; } - if ($this->out_doc_description !== $sValue || $sValue === '') { + if (in_array(OutputDocumentPeer::OUT_DOC_DESCRIPTION, $this->modifiedColumns) || $sValue === '') { try { $this->out_doc_description = $sValue; @@ -457,7 +456,7 @@ class OutputDocument extends BaseOutputDocument $sValue = (string) $sValue; } - if ($this->out_doc_filename !== $sValue || $sValue === '') { + if (in_array(OutputDocumentPeer::OUT_DOC_FILENAME, $this->modifiedColumns) || $sValue === '') { try { $this->out_doc_filename = $sValue; @@ -503,7 +502,7 @@ class OutputDocument extends BaseOutputDocument $sValue = (string) $sValue; } - if ($this->out_doc_template !== $sValue || $sValue === '') { + if (in_array(OutputDocumentPeer::OUT_DOC_TEMPLATE, $this->modifiedColumns) || $sValue === '') { try { $this->out_doc_template = $sValue; diff --git a/workflow/engine/classes/model/Process.php b/workflow/engine/classes/model/Process.php index 500fe35a9..e0d0f9ee0 100644 --- a/workflow/engine/classes/model/Process.php +++ b/workflow/engine/classes/model/Process.php @@ -83,7 +83,7 @@ class Process extends BaseProcess $v = (string) $v; } - if ($this->pro_title_content !== $v || $v === '') { + if (in_array(ProcessPeer::PRO_TITLE, $this->modifiedColumns) || $v === '') { $this->pro_title_content = $v; $lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en'; @@ -132,7 +132,7 @@ class Process extends BaseProcess $v = (string) $v; } - if ($this->pro_description_content !== $v || $v === '') { + if (in_array(ProcessPeer::PRO_DESCRIPTION, $this->modifiedColumns) || $v === '') { $this->pro_description_content = $v; $lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en'; @@ -176,7 +176,7 @@ class Process extends BaseProcess $this->setProParent( $sNewProUid ); $this->setProTime( 1 ); $this->setProTimeunit( 'DAYS' ); - $this->setProStatus( 'ACTIVE' ); + $this->setProStatus((isset($aData["PRO_STATUS"])) ? $aData["PRO_STATUS"] : 'ACTIVE'); $this->setProTypeDay( '' ); $this->setProType((isset($aData["PRO_TYPE"]))? $aData["PRO_TYPE"]: "NORMAL"); $this->setProAssignment( 'FALSE' ); @@ -198,7 +198,6 @@ class Process extends BaseProcess if ($this->validate()) { $con->begin(); - $res = $this->save(); if (isset( $aData['PRO_TITLE'] )) { $this->setProTitleContent( $aData['PRO_TITLE'] ); @@ -212,6 +211,7 @@ class Process extends BaseProcess $this->setProDescriptionContent( 'Default Process Description' ); } + $res = $this->save(); $con->commit(); $this->memcachedDelete(); @@ -445,7 +445,6 @@ class Process extends BaseProcess $this->setProDynaforms( isset( $aData['PRO_DYNAFORMS'] ) ? (is_array( $aData['PRO_DYNAFORMS'] ) ? serialize( $aData['PRO_DYNAFORMS'] ) : $aData['PRO_DYNAFORMS']) : '' ); if ($this->validate()) { $con->begin(); - $res = $this->save(); if (isset( $aData['PRO_TITLE'] ) && trim( $aData['PRO_TITLE'] ) != '') { $this->setProTitleContent( $aData['PRO_TITLE'] ); @@ -457,6 +456,8 @@ class Process extends BaseProcess } else { $this->setProDescriptionContent( 'Default Process Description' ); } + + $res = $this->save(); $con->commit(); $this->memcachedDelete(); diff --git a/workflow/engine/classes/model/ReportTable.php b/workflow/engine/classes/model/ReportTable.php index 86c6ffcff..9645180f5 100644 --- a/workflow/engine/classes/model/ReportTable.php +++ b/workflow/engine/classes/model/ReportTable.php @@ -71,7 +71,7 @@ class ReportTable extends BaseReportTable } $v = isset( $v ) ? ((string) $v) : ''; $lang = defined( 'SYS_LANG' ) ? SYS_LANG : 'en'; - if ($this->rep_tab_title !== $v || $v === "") { + if (in_array(ReportTablePeer::REP_TAB_TITLE, $this->modifiedColumns) || $v === "") { $this->rep_tab_title = $v; $res = Content::addContent( 'REP_TAB_TITLE', '', $this->getRepTabUid(), $lang, $this->rep_tab_title ); return $res; diff --git a/workflow/engine/classes/model/Route.php b/workflow/engine/classes/model/Route.php index ff6775c6f..f50a24062 100644 --- a/workflow/engine/classes/model/Route.php +++ b/workflow/engine/classes/model/Route.php @@ -384,4 +384,23 @@ class Route extends BaseRoute $this->updateRouteOrder($accountsArray); } } + + /** + * Get the route for the specific task + * + * @param $tasUid string + * @return $nextRoute array + */ + public function getNextRouteByTask($tasUid) + { + $oCriteria = new Criteria( 'workflow' ); + $oCriteria->addSelectColumn( RoutePeer::ROU_TYPE ); + $oCriteria->addSelectColumn( RoutePeer::ROU_NEXT_TASK ); + $oCriteria->add( RoutePeer::TAS_UID, $tasUid ); + $oDataset = TaskPeer::doSelectRS( $oCriteria ); + $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $oDataset->next(); + $row = $oDataset->getRow(); + return (is_array($row)) ? $row : array(); + } } diff --git a/workflow/engine/classes/model/Task.php b/workflow/engine/classes/model/Task.php index 890f1a86d..2e72dc8a7 100644 --- a/workflow/engine/classes/model/Task.php +++ b/workflow/engine/classes/model/Task.php @@ -53,7 +53,7 @@ class Task extends BaseTask $v = isset($v)? ((string)$v) : ''; $lang = defined('SYS_LANG')? SYS_LANG : 'en'; - if ($this->tas_title_content !== $v || $v === "") { + if (in_array(TaskPeer::TAS_TITLE, $this->modifiedColumns) || $v === "") { $this->tas_title_content = $v; $res = Content::addContent('TAS_TITLE', '', $this->getTasUid(), $lang, $this->tas_title_content); @@ -101,7 +101,7 @@ class Task extends BaseTask $v = isset($v)? ((string)$v) : ''; $lang = defined('SYS_LANG')? SYS_LANG : 'en'; - if ($this->tas_description_content !== $v || $v === "") { + if (in_array(TaskPeer::TAS_DESCRIPTION, $this->modifiedColumns) || $v === "") { $this->tas_description_content = $v; $res = Content::addContent('TAS_DESCRIPTION', '', $this->getTasUid(), $lang, $this->tas_description_content); @@ -149,7 +149,7 @@ class Task extends BaseTask $v = isset($v)? ((string)$v) : ''; $lang = defined('SYS_LANG')? SYS_LANG : 'en'; - if ($this->tas_def_title_content !== $v || $v === "") { + if (in_array(TaskPeer::TAS_DEF_TITLE, $this->modifiedColumns) || $v === "") { $this->tas_def_title_content = $v; $res = Content::addContent('TAS_DEF_TITLE', '', $this->getTasUid(), $lang, $this->tas_def_title_content); @@ -197,7 +197,7 @@ class Task extends BaseTask $v = isset($v)? ((string)$v) : ''; $lang = defined('SYS_LANG')? SYS_LANG : 'en'; - if ($this->tas_def_description_content !== $v || $v === "") { + if (in_array(TaskPeer::TAS_DEF_DESCRIPTION, $this->modifiedColumns) || $v === "") { $this->tas_def_description_content = $v; $res = Content::addContent('TAS_DEF_DESCRIPTION', '', $this->getTasUid(), $lang, $v); @@ -244,7 +244,7 @@ class Task extends BaseTask $v = isset($v)? ((string)$v) : ''; $lang = defined('SYS_LANG')? SYS_LANG : 'en'; - if ($this->tas_def_proc_code_content !== $v || $v === "") { + if (in_array(TaskPeer::TAS_DEF_PROC_CODE, $this->modifiedColumns) || $v === "") { $this->tas_def_proc_code_content = $v; $res = Content::addContent('TAS_DEF_PROC_CODE', '', $this->getTasUid(), $lang, $this->tas_def_proc_code_content); @@ -291,7 +291,7 @@ class Task extends BaseTask $v = isset($v)? ((string)$v) : ''; $lang = defined('SYS_LANG')? SYS_LANG : 'en'; - if ($this->tas_def_message_content !== $v || $v === "") { + if (in_array(TaskPeer::TAS_DEF_MESSAGE, $this->modifiedColumns) || $v === "") { $this->tas_def_message_content = $v; $res = Content::addContent('TAS_DEF_MESSAGE', '', $this->getTasUid(), $lang, $this->tas_def_message_content); @@ -339,7 +339,7 @@ class Task extends BaseTask $v = isset($v)? ((string)$v) : ''; $lang = defined('SYS_LANG')? SYS_LANG : 'en'; - if ($this->tas_def_subject_message_content !== $v || $v === "") { + if (in_array(TaskPeer::TAS_DEF_SUBJECT_MESSAGE, $this->modifiedColumns) || $v === "") { $this->tas_def_subject_message_content = $v; $res = Content::addContent('TAS_DEF_SUBJECT_MESSAGE', '', $this->getTasUid(), $lang, $v); diff --git a/workflow/engine/classes/model/Triggers.php b/workflow/engine/classes/model/Triggers.php index 0c7e3619b..b7eeb7bf6 100644 --- a/workflow/engine/classes/model/Triggers.php +++ b/workflow/engine/classes/model/Triggers.php @@ -76,7 +76,7 @@ class Triggers extends BaseTriggers } $v=isset($v)?((string)$v):''; $lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en'; - if ($this->tri_title_content !== $v || $v==="") { + if (in_array(TriggersPeer::TRI_TITLE, $this->modifiedColumns) || $v==="") { $this->tri_title_content = $v; $res = Content::addContent( 'TRI_TITLE', '', $this->getTriUid(), $lang, $this->tri_title_content ); return $res; @@ -112,7 +112,7 @@ class Triggers extends BaseTriggers } $v=isset($v)?((string)$v):''; $lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en'; - if ($this->tri_description !== $v || $v==="") { + if (in_array(TriggersPeer::TRI_DESCRIPTION, $this->modifiedColumns) || $v==="") { $this->tri_description = $v; $res = Content::addContent( 'TRI_DESCRIPTION', '', $this->getTriUid(), $lang, $this->tri_description ); return $res; @@ -169,9 +169,9 @@ class Triggers extends BaseTriggers } else { $this->setTriParam( $aData['TRI_PARAM'] ); } - $result=$this->save(); $this->setTriTitleContent($triTitle); $this->setTriDescriptionContent($triDescription); + $result = $this->save(); $con->commit(); //Add Audit Log $description = "Trigger Name: ".$aData['TRI_TITLE'].", Trigger Uid: ".$triggerUid; diff --git a/workflow/engine/content/translations/english/processmaker.en.po b/workflow/engine/content/translations/english/processmaker.en.po index 592a61be5..c61836c54 100644 --- a/workflow/engine/content/translations/english/processmaker.en.po +++ b/workflow/engine/content/translations/english/processmaker.en.po @@ -2107,6 +2107,12 @@ msgstr "in" msgid "This case does not exist" msgstr "This case does not exist" +# TRANSLATION +# LABEL/ID_APPLICATION_OR_INDEX_MISSING +#: LABEL/ID_APPLICATION_OR_INDEX_MISSING +msgid "Application ID or Delegation Index is missing!. The System can not open the case." +msgstr "Application ID or Delegation Index is missing!. The System can not open the case." + # TRANSLATION # LABEL/ID_PLEASE_SELECT_UPGRADE_FILE #: LABEL/ID_PLEASE_SELECT_UPGRADE_FILE @@ -3058,8 +3064,8 @@ msgstr "Role" # TRANSLATION # LABEL/ID_MSG_CANNOT_DELETE_USER #: LABEL/ID_MSG_CANNOT_DELETE_USER -msgid "User cannot be deleted while still assigned to cases." -msgstr "User cannot be deleted while still assigned to cases." +msgid "The user cannot be deleted since it is referenced in a process design and/or has assigned cases." +msgstr "The user cannot be deleted since it is referenced in a process design and/or has assigned cases." # TRANSLATION # LABEL/ID_MSG_REMOVE_PLUGIN @@ -6076,8 +6082,8 @@ msgstr "First select a PM Table from the list please." # TRANSLATION # LABEL/ID_CONFIRM_DELETE_PM_TABLE #: LABEL/ID_CONFIRM_DELETE_PM_TABLE -msgid "Do you want to delete selected tables?" -msgstr "Do you want to delete selected tables?" +msgid "Do you want to delete the selected tables?" +msgstr "Do you want to delete the selected tables?" # TRANSLATION # LABEL/ID_TITLE_START_CASE @@ -6340,8 +6346,8 @@ msgstr "First select a ROW from the list" # TRANSLATION # LABEL/ID_MSG_CONFIRM_DELETE_ROW #: LABEL/ID_MSG_CONFIRM_DELETE_ROW -msgid "Do you want to delete selected row?" -msgstr "Do you want to delete selected row?" +msgid "Do you want to delete the selected row?" +msgstr "Do you want to delete the selected row?" # TRANSLATION # LABEL/ID_SENT_BY @@ -7294,8 +7300,8 @@ msgstr "Edit Department" # TRANSLATION # LABEL/ID_CONFIRM_DELETE_DEPARTMENT #: LABEL/ID_CONFIRM_DELETE_DEPARTMENT -msgid "Do you want to delete selected department?" -msgstr "Do you want to delete selected department?" +msgid "Do you want to delete the selected department?" +msgstr "Do you want to delete the selected department?" # TRANSLATION # LABEL/ID_DEPARTMENT_SUCCESS_DELETE @@ -7384,8 +7390,8 @@ msgstr "The category cannot be deleted while it is still assigned to processes." # TRANSLATION # LABEL/ID_CONFIRM_DELETE_CATEGORY #: LABEL/ID_CONFIRM_DELETE_CATEGORY -msgid "Do you want to delete selected category?" -msgstr "Do you want to delete selected category?" +msgid "Do you want to delete the selected category?" +msgstr "Do you want to delete the selected category?" # TRANSLATION # LABEL/ID_GROUP_USERS @@ -8128,8 +8134,8 @@ msgstr "Starting Task" # TRANSLATION # LABEL/ID_CONFIRM_DELETE_AUTHENTICATION #: LABEL/ID_CONFIRM_DELETE_AUTHENTICATION -msgid "Do you want to delete selected authentication source?" -msgstr "Do you want to delete selected authentication source?" +msgid "Do you want to delete the selected authentication source?" +msgstr "Do you want to delete the selected authentication source?" # TRANSLATION # LABEL/ID_ASSIGNMENT_RULES @@ -8896,8 +8902,8 @@ msgstr "Rich Text File" # TRANSLATION # LABEL/ID_CONFIRM_DELETE_CALENDAR #: LABEL/ID_CONFIRM_DELETE_CALENDAR -msgid "Do you want to delete selected calendar?" -msgstr "Do you want to delete selected calendar?" +msgid "Do you want to delete the selected calendar?" +msgstr "Do you want to delete the selected calendar?" # TRANSLATION # LABEL/ID_CALENDAR_SUCCESS_DELETE @@ -9412,8 +9418,8 @@ msgstr "Input Document has been deleted correctly." # TRANSLATION # LABEL/ID_CONFIRM_DELETE_INPUT_DOC #: LABEL/ID_CONFIRM_DELETE_INPUT_DOC -msgid "Do you want to delete selected Input Document?" -msgstr "Do you want to delete selected Input Document?" +msgid "Do you want to delete the selected Input Document?" +msgstr "Do you want to delete the selected Input Document?" # TRANSLATION # LABEL/ID_MSG_CANNOT_DELETE_INPUT_DOC @@ -10444,8 +10450,8 @@ msgstr "From each table select at least one Schema/Data to export." # TRANSLATION # LABEL/ID_CONFIRM_DELETE_SKIN #: LABEL/ID_CONFIRM_DELETE_SKIN -msgid "Do you want to delete selected skin?" -msgstr "Do you want to delete selected skin?" +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 @@ -11923,6 +11929,12 @@ msgstr "Administrators users cannot use this User Experience." msgid "Import PM Table" msgstr "Import PM Table" +# TRANSLATION +# LABEL/ID_THE_NAME_CHANGE_MAY_CAUSE_DATA_LOSS +#: LABEL/ID_THE_NAME_CHANGE_MAY_CAUSE_DATA_LOSS +msgid "The change might cause data loss in the PM table. Do you want to continue?" +msgstr "The change might cause data loss in the PM table. Do you want to continue?" + # TRANSLATION # LABEL/ID_OVERWRITE_EXIST #: LABEL/ID_OVERWRITE_EXIST diff --git a/workflow/engine/controllers/newSiteProxy.php b/workflow/engine/controllers/newSiteProxy.php index 969454bef..88726845d 100644 --- a/workflow/engine/controllers/newSiteProxy.php +++ b/workflow/engine/controllers/newSiteProxy.php @@ -30,9 +30,9 @@ class newSiteProxy extends HttpProxyController return; } } - $user = (isset( $_POST['NW_USERNAME'] )) ? trim( $_POST['NW_USERNAME'] ) : 'admin'; - $pass = (isset( $_POST['NW_PASSWORD'] )) ? $_POST['NW_PASSWORD'] : 'admin'; - $pass1 = (isset( $_POST['NW_PASSWORD2'] )) ? $_POST['NW_PASSWORD2'] : 'admin'; + $user = (isset($_POST['NW_USERNAME'])) ? trim($_POST['NW_USERNAME']) : 'admin'; + $pass = (isset($_POST['NW_PASSWORD'])) ? trim($_POST['NW_PASSWORD']) : 'admin'; + $pass1 = (isset($_POST['NW_PASSWORD2'])) ? trim($_POST['NW_PASSWORD2']) : 'admin'; $ao_db_wf = (isset( $_POST['AO_DB_WF'] )) ? $_POST['AO_DB_WF'] : false; diff --git a/workflow/engine/data/mysql/insert.sql b/workflow/engine/data/mysql/insert.sql index 39c9117d5..5d64cdb0f 100644 --- a/workflow/engine/data/mysql/insert.sql +++ b/workflow/engine/data/mysql/insert.sql @@ -1792,6 +1792,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_CASE_IS_CURRENTLY_WITH_ANOTHER_USER','en','The case is currently opened by another user','2014-01-15') , ( 'LABEL','ID_IN','en','in','2014-01-15') , ( 'LABEL','ID_CASE_DOES_NOT_EXISTS','en','This case does not exist','2014-01-15') , +( 'LABEL','ID_APPLICATION_OR_INDEX_MISSING','en','Application ID or Delegation Index is missing!. The System can not open the case.','2017-03-30') , ( 'LABEL','ID_PLEASE_SELECT_UPGRADE_FILE','en','Please select the upgrade file','2014-01-15') , ( 'LABEL','ID_PLEASE_SELECT_MAX_X_FIELDS','en','Please select 80 fields at most','2014-01-15') , ( 'LABEL','ID_UPGRADE_READY','en','System upgraded from revision','2014-01-15') , @@ -1953,7 +1954,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_PENDING','en','Pending','2014-01-15') , ( 'LABEL','ID_FULL_NAME','en','Full Name','2014-01-15') , ( 'LABEL','ID_ROLE','en','Role','2014-01-15') , -( 'LABEL','ID_MSG_CANNOT_DELETE_USER','en','User cannot be deleted while still assigned to cases.','2014-10-21') , +( 'LABEL','ID_MSG_CANNOT_DELETE_USER','en','The user cannot be deleted since it is referenced in a process design and/or has assigned cases.','2017-03-22') , ( 'LABEL','ID_MSG_REMOVE_PLUGIN','en','Are you sure that you want to remove this plugin?','2014-01-15') , ( 'JAVASCRIPT','USERS_REASSIGN','en','This user cannot be deleted because he/she still has some pending tasks.

Do you want to reassign these tasks to another user now?','2014-01-15') , ( 'LABEL','LOGIN_VERIFY_MSG','en','Verifying...','2014-01-15') , @@ -2468,7 +2469,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_NEW_ADD_TABLE','en','New PM Table','2014-01-15') , ( 'LABEL','ID_FIELD_DYNAFORM_TEXT','en','text','2014-01-15') , ( 'LABEL','ID_SELECT_FIRST_PM_TABLE_ROW','en','First select a PM Table from the list please.','2014-01-15') , -( 'LABEL','ID_CONFIRM_DELETE_PM_TABLE','en','Do you want to delete selected tables?','2014-01-15') , +( 'LABEL','ID_CONFIRM_DELETE_PM_TABLE','en','Do you want to delete the selected tables?','2017-04-21') , ( 'LABEL','ID_TITLE_START_CASE','en','Start Case','2014-01-15') , ( 'LABEL','ID_STARTING_NEW_CASE','en','Starting new case','2014-01-15') , ( 'LABEL','ID_ERROR_CREATING_NEW_CASE','en','Error creating a new Case','2014-01-15') , @@ -2514,7 +2515,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_CHECK_ALL','en','Check All','2014-01-15') , ( 'LABEL','ID_UN_CHECK_ALL','en','Un-Check All','2014-01-15') , ( 'LABEL','ID_SELECT_FIRST_ROW','en','First select a ROW from the list','2014-01-15') , -( 'LABEL','ID_MSG_CONFIRM_DELETE_ROW','en','Do you want to delete selected row?','2014-01-15') , +( 'LABEL','ID_MSG_CONFIRM_DELETE_ROW','en','Do you want to delete the selected row?','2017-04-21') , ( 'LABEL','ID_SENT_BY','en','Sent By','2014-01-15') , ( 'LABEL','ID_CURRENT_USER','en','Current User','2014-01-15') , ( 'LABEL','ID_LAST_MODIFY','en','Last Modified','2017-02-21') , @@ -2677,7 +2678,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_DEPARTMENT_EXISTS','en','Department name already exists.','2014-01-15') , ( 'LABEL','ID_DEPARTMENT_SUCCESS_UPDATE','en','Department has been updated correctly.','2014-01-15') , ( 'LABEL','ID_EDIT_DEPARTMENT','en','Edit Department','2014-01-15') , -( 'LABEL','ID_CONFIRM_DELETE_DEPARTMENT','en','Do you want to delete selected department?','2014-01-15') , +( 'LABEL','ID_CONFIRM_DELETE_DEPARTMENT','en','Do you want to delete the selected department?','2017-04-21') , ( 'LABEL','ID_DEPARTMENT_SUCCESS_DELETE','en','Department has been deleted correctly.','2014-01-15') , ( 'LABEL','ID_MSG_CANNOT_DELETE_DEPARTMENT','en','The department cannot be deleted while it has assigned users.','2014-10-21') , ( 'LABEL','ID_MANAGER','en','Manager','2014-01-15') , @@ -2692,7 +2693,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_CATEGORY_SUCCESS_UPDATE','en','Process category has been updated correctly.','2014-01-15') , ( 'LABEL','ID_CATEGORY_SUCCESS_DELETE','en','Process category has been deleted correctly.','2014-01-15') , ( 'LABEL','ID_MSG_CANNOT_DELETE_CATEGORY','en','The category cannot be deleted while it is still assigned to processes.','2014-10-21') , -( 'LABEL','ID_CONFIRM_DELETE_CATEGORY','en','Do you want to delete selected category?','2014-01-15') , +( 'LABEL','ID_CONFIRM_DELETE_CATEGORY','en','Do you want to delete the selected category?','2017-04-21') , ( 'LABEL','ID_GROUP_USERS','en','Group or Users','2014-01-15') , ( 'LABEL','ID_DOWNLOADING_FILE','en','Downloading file','2014-01-15') , ( 'LABEL','IMPORT_PROCESS_OVERWRITING','en','Update the current process, overwriting all tasks and steps','2014-01-15') , @@ -2818,7 +2819,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_AUTHENTICATION_SUCCESS_DELETE','en','Authentication source has been deleted correctly.','2014-01-15') , ( 'LABEL','ID_VARIABLES_CASE_PRIORITY','en','Variable for Case priority','2014-01-15') , ( 'LABEL','ID_START_TASK','en','Starting Task','2014-01-15') , -( 'LABEL','ID_CONFIRM_DELETE_AUTHENTICATION','en','Do you want to delete selected authentication source?','2014-01-15') , +( 'LABEL','ID_CONFIRM_DELETE_AUTHENTICATION','en','Do you want to delete the selected authentication source?','2017-04-21') , ( 'LABEL','ID_ASSIGNMENT_RULES','en','Assignment Rules','2014-01-15') , ( 'LABEL','ID_CASES_ASSIGNED_BY','en','Cases to be Assigned by','2014-01-15') , ( 'LABEL','ID_CYCLIC_ASSIGNMENT','en','Cyclic Assignment','2014-01-15') , @@ -2950,8 +2951,8 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','MIME_DES_DOC','en','Word Document','2014-01-15') , ( 'LABEL','MIME_DES_XLS','en','Excel Document','2014-01-15') , ( 'LABEL','MIME_DES_RTF','en','Rich Text File','2014-01-15') , -( 'LABEL','ID_CONFIRM_DELETE_CALENDAR','en','Do you want to delete selected calendar?','2014-01-15') , -( 'LABEL','ID_CALENDAR_SUCCESS_DELETE','en','Calendar has been deleted correctly.','2014-01-15') , +( 'LABEL','ID_CONFIRM_DELETE_CALENDAR','en','Do you want to delete the selected calendar?','2014-01-15') , +( 'LABEL','ID_CALENDAR_SUCCESS_DELETE','en','Calendar has been deleted correctly.','2017-04-21') , ( 'LABEL','ID_MSG_CANNOT_DELETE_CALENDAR','en','The calendar cannot be deleted while it has assignations','2014-10-21') , ( 'LABEL','ID_REMOVED_SESSION_FILES','en','Older session files has been removed','2014-01-15') , ( 'LABEL','ID_NO_OLDER_SESSION_FILES','en','There are no older session files','2014-01-15') , @@ -3038,7 +3039,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_INPUT_DOC_SUCCESS_NEW','en','Input Document has been created correctly.','2014-01-15') , ( 'LABEL','ID_INPUT_DOC_SUCCESS_UPDATE','en','Input Document has been updated correctly.','2014-01-15') , ( 'LABEL','ID_INPUT_DOC_SUCCESS_DELETE','en','Input Document has been deleted correctly.','2014-01-15') , -( 'LABEL','ID_CONFIRM_DELETE_INPUT_DOC','en','Do you want to delete selected Input Document?','2014-01-15') , +( 'LABEL','ID_CONFIRM_DELETE_INPUT_DOC','en','Do you want to delete the selected Input Document?','2017-04-21') , ( 'LABEL','ID_MSG_CANNOT_DELETE_INPUT_DOC','en','Input Document cannot be deleted while has assigned tasks.','2014-01-15') , ( 'LABEL','ID_SOME_FIELDS_REQUIRED','en','Some Fields are required.','2014-01-15') , ( 'LABEL','ID_INPUT_DOC_TITLE_REQUIRED','en','Input Document Title is required.','2014-01-15') , @@ -3214,7 +3215,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_NULL','en','Null','2014-01-15') , ( '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 selected skin?','2014-01-15') , +( '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_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') , @@ -3467,6 +3468,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'JAVASCRIPT','ID_MESSAGE_FIELD_REQUIRED','en','Message Field is required.','2014-01-15') , ( 'JAVASCRIPT','ID_TEMPLATE_FIELD_REQUIRED','en','Template Field is required.','2014-01-15') , ( 'LABEL','ID_ADMINS_CANT_USE_UXS','en','Administrators users cannot use this User Experience.','2014-01-15') , +( 'LABEL','ID_THE_NAME_CHANGE_MAY_CAUSE_DATA_LOSS','en','The change might cause data loss in the PM table. Do you want to continue?','2017-03-30') , ( 'LABEL','ID_IMPORT_PMT','en','Import PM Table','2014-01-15') , ( 'LABEL','ID_OVERWRITE_EXIST','en','Overwrite if exists?','2014-01-15') , ( 'LABEL','ID_SELECT_PM_FILE','en','Select a .pmt file','2014-01-15') , diff --git a/workflow/engine/methods/cases/casesSaveDataView.php b/workflow/engine/methods/cases/casesSaveDataView.php index 149b10ddc..1f0d77bf7 100644 --- a/workflow/engine/methods/cases/casesSaveDataView.php +++ b/workflow/engine/methods/cases/casesSaveDataView.php @@ -61,7 +61,7 @@ $_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] = count( $triggers ); $_SESSION['TRIGGER_DEBUG']['TIME'] = G::toUpper(G::loadTranslation('ID_AFTER')); if ($_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] != 0) { - $_SESSION['TRIGGER_DEBUG']['TRIGGERS_NAMES'] = $oCase->getTriggerNames( $triggers ); + $_SESSION['TRIGGER_DEBUG']['TRIGGERS_NAMES'] = array_column($triggers, 'TRI_TITLE'); $_SESSION['TRIGGER_DEBUG']['TRIGGERS_VALUES'] = $triggers; } diff --git a/workflow/engine/methods/cases/cases_Derivate.php b/workflow/engine/methods/cases/cases_Derivate.php index b7fee6e51..aa8daeb7d 100644 --- a/workflow/engine/methods/cases/cases_Derivate.php +++ b/workflow/engine/methods/cases/cases_Derivate.php @@ -100,7 +100,7 @@ try { //save trigger variables for debugger $_SESSION['TRIGGER_DEBUG']['info'][0]['NUM_TRIGGERS'] = sizeof( $triggers ); $_SESSION['TRIGGER_DEBUG']['info'][0]['TIME'] = G::toUpper(G::loadTranslation('ID_BEFORE')); - $_SESSION['TRIGGER_DEBUG']['info'][0]['TRIGGERS_NAMES'] = $oCase->getTriggerNames( $triggers ); + $_SESSION['TRIGGER_DEBUG']['info'][0]['TRIGGERS_NAMES'] = array_column($triggers, 'TRI_TITLE'); $_SESSION['TRIGGER_DEBUG']['info'][0]['TRIGGERS_VALUES'] = $triggers; $_SESSION['TRIGGER_DEBUG']['info'][0]['TRIGGERS_EXECUTION_TIME'] = $oCase->arrayTriggerExecutionTime; $arrayInfoTriggerExecutionTime = []; @@ -171,7 +171,7 @@ try { $_SESSION['TRIGGER_DEBUG']['info'][1]['NUM_TRIGGERS'] = sizeof( $triggers ); $_SESSION['TRIGGER_DEBUG']['info'][1]['TIME'] = G::toUpper(G::loadTranslation('ID_AFTER')); - $_SESSION['TRIGGER_DEBUG']['info'][1]['TRIGGERS_NAMES'] = $oCase->getTriggerNames( $triggers ); + $_SESSION['TRIGGER_DEBUG']['info'][1]['TRIGGERS_NAMES'] = array_column($triggers, 'TRI_TITLE'); $_SESSION['TRIGGER_DEBUG']['info'][1]['TRIGGERS_VALUES'] = $triggers; $_SESSION['TRIGGER_DEBUG']['info'][1]['TRIGGERS_EXECUTION_TIME'] = $oCase->arrayTriggerExecutionTime; $arrayInfoTriggerExecutionTimeAux = []; diff --git a/workflow/engine/methods/cases/cases_SaveData.php b/workflow/engine/methods/cases/cases_SaveData.php index 30c3e5cc7..1598396e8 100644 --- a/workflow/engine/methods/cases/cases_SaveData.php +++ b/workflow/engine/methods/cases/cases_SaveData.php @@ -166,7 +166,7 @@ try { $_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] = count( $triggers ); $_SESSION['TRIGGER_DEBUG']['TIME'] = G::toUpper(G::loadTranslation('ID_AFTER')); if ($_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] != 0) { - $_SESSION['TRIGGER_DEBUG']['TRIGGERS_NAMES'] = $oCase->getTriggerNames( $triggers ); + $_SESSION['TRIGGER_DEBUG']['TRIGGERS_NAMES'] = array_column($triggers, 'TRI_TITLE'); $_SESSION['TRIGGER_DEBUG']['TRIGGERS_VALUES'] = $triggers; $oProcess = new Process(); $oProcessFieds = $oProcess->Load( $_SESSION['PROCESS'] ); diff --git a/workflow/engine/methods/cases/cases_SaveDocument.php b/workflow/engine/methods/cases/cases_SaveDocument.php index f461fbec6..2cd53b388 100644 --- a/workflow/engine/methods/cases/cases_SaveDocument.php +++ b/workflow/engine/methods/cases/cases_SaveDocument.php @@ -90,7 +90,7 @@ $_SESSION["TRIGGER_DEBUG"]["NUM_TRIGGERS"] = count($arrayTrigger); $_SESSION["TRIGGER_DEBUG"]["TIME"] = "AFTER"; if ($_SESSION["TRIGGER_DEBUG"]["NUM_TRIGGERS"] > 0) { - $_SESSION["TRIGGER_DEBUG"]["TRIGGERS_NAMES"] = $case->getTriggerNames($arrayTrigger); + $_SESSION["TRIGGER_DEBUG"]["TRIGGERS_NAMES"] = array_column($arrayTrigger, 'TRI_TITLE'); $_SESSION["TRIGGER_DEBUG"]["TRIGGERS_VALUES"] = $arrayTrigger; } diff --git a/workflow/engine/methods/cases/cases_Step.php b/workflow/engine/methods/cases/cases_Step.php index 5b9d01cb7..4a79402f1 100644 --- a/workflow/engine/methods/cases/cases_Step.php +++ b/workflow/engine/methods/cases/cases_Step.php @@ -209,7 +209,7 @@ if ($flagExecuteBeforeTriggers) { $_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] = count( $triggers ); $_SESSION['TRIGGER_DEBUG']['TIME'] = G::toUpper(G::loadTranslation('ID_BEFORE')); if ($_SESSION['TRIGGER_DEBUG']['NUM_TRIGGERS'] != 0) { - $_SESSION['TRIGGER_DEBUG']['TRIGGERS_NAMES'] = $oCase->getTriggerNames( $triggers ); + $_SESSION['TRIGGER_DEBUG']['TRIGGERS_NAMES'] = array_column($triggers, 'TRI_TITLE'); $_SESSION['TRIGGER_DEBUG']['TRIGGERS_VALUES'] = $triggers; } @@ -418,7 +418,7 @@ try { $oHeadPublisher = & headPublisher::getSingleton(); - $titleDocument = "

" . $Fields['INP_DOC_TITLE'] . "
" . G::LoadTranslation( 'ID_INPUT_DOCUMENT' ) . "

"; + $titleDocument = "

" . htmlspecialchars($Fields['INP_DOC_TITLE'], ENT_QUOTES) . "
" . G::LoadTranslation('ID_INPUT_DOCUMENT') . "

"; if ($Fields['INP_DOC_DESCRIPTION']) { $titleDocument .= " " . str_replace( "\n", "", str_replace( "'", "\'", nl2br( html_entity_decode($Fields['INP_DOC_DESCRIPTION'], ENT_COMPAT, "UTF-8") ) ) ) . ""; } diff --git a/workflow/engine/methods/cases/open.php b/workflow/engine/methods/cases/open.php index 07f4d0219..fe6ea043c 100644 --- a/workflow/engine/methods/cases/open.php +++ b/workflow/engine/methods/cases/open.php @@ -34,25 +34,34 @@ if(isset( $_GET['gmail']) && $_GET['gmail'] == 1){ $tBarGmail = true; } -if (! isset( $_GET['APP_UID'] ) || ! isset( $_GET['DEL_INDEX'] )) { - if (isset( $_GET['APP_NUMBER'] )) { - G::LoadClass( 'case' ); - $oCase = new Cases(); - $appUid = $oCase->getApplicationUIDByNumber( htmlspecialchars($_GET['APP_NUMBER']) ); - $delIndex = $oCase->getCurrentDelegation( $appUid, $_SESSION['USER_LOGGED'] ); - if (is_null( $appUid )) { - throw new Exception( G::LoadTranslation( 'ID_CASE_DOES_NOT_EXISTS' ) ); - } - if (is_null( $delIndex )) { - throw new Exception( G::LoadTranslation( 'ID_CASE_IS_CURRENTLY_WITH_ANOTHER_USER' ) ); - } - } else { - throw new Exception( "Application ID or Delegation Index is missing!. The System can't open the case." ); +//Check if we have the information for open the case +if (!isset($_GET['APP_UID']) && !isset($_GET['APP_NUMBER']) && !isset($_GET['DEL_INDEX'])) { + throw new Exception(G::LoadTranslation('ID_APPLICATION_OR_INDEX_MISSING')); +} +//Get the APP_UID related to APP_NUMBER +if (!isset($_GET['APP_UID']) && isset($_GET['APP_NUMBER'])) { + G::LoadClass('case'); + $oCase = new Cases(); + $appUid = $oCase->getApplicationUIDByNumber(htmlspecialchars($_GET['APP_NUMBER'])); + if (is_null( $appUid )) { + throw new Exception(G::LoadTranslation('ID_CASE_DOES_NOT_EXISTS')); } } else { $appUid = htmlspecialchars($_GET['APP_UID']); +} +//If we don't have the DEL_INDEX we get the current delIndex. Data reporting tool does not have this information +if (!isset($_GET['DEL_INDEX'])) { + G::LoadClass('case'); + $oCase = new Cases(); + $delIndex = $oCase->getCurrentDelegation($appUid, $_SESSION['USER_LOGGED']); + if (is_null( $delIndex )) { + throw new Exception(G::LoadTranslation('ID_CASE_IS_CURRENTLY_WITH_ANOTHER_USER')); + } + $_GET['DEL_INDEX'] = $delIndex; +} else { $delIndex = htmlspecialchars($_GET['DEL_INDEX']); } + $tasUid = (isset($_GET['TAS_UID'])) ? $tasUid = htmlspecialchars($_GET['TAS_UID']) : ''; require_once ("classes/model/Step.php"); diff --git a/workflow/engine/methods/cases/proxyCasesList.php b/workflow/engine/methods/cases/proxyCasesList.php index 48a60a32a..7f728ff43 100644 --- a/workflow/engine/methods/cases/proxyCasesList.php +++ b/workflow/engine/methods/cases/proxyCasesList.php @@ -4,7 +4,7 @@ if (!isset($_SESSION['USER_LOGGED'])) { $responseObject->error = G::LoadTranslation('ID_LOGIN_AGAIN'); $responseObject->success = true; $responseObject->lostSession = true; - print G::json_encode( $responseObject ); + print G::json_encode($responseObject); die(); } @@ -15,29 +15,29 @@ $_REQUEST = $filter->xssFilterHard($_REQUEST); $_SESSION['USER_LOGGED'] = $filter->xssFilterHard($_SESSION['USER_LOGGED']); //Getting the extJs parameters -$callback = isset( $_REQUEST["callback"] ) ? $_REQUEST["callback"] : "stcCallback1001"; +$callback = isset($_REQUEST["callback"]) ? $_REQUEST["callback"] : "stcCallback1001"; //This default value was defined in casesList.js -$dir = isset( $_REQUEST["dir"] ) ? $_REQUEST["dir"] : "DESC"; +$dir = isset($_REQUEST["dir"]) ? $_REQUEST["dir"] : "DESC"; //This default value was defined in casesList.js -$sort = isset( $_REQUEST["sort"] ) ? $_REQUEST["sort"] : "APP_NUMBER"; -$start = isset( $_REQUEST["start"] ) ? $_REQUEST["start"] : "0"; -$limit = isset( $_REQUEST["limit"] ) ? $_REQUEST["limit"] : "25"; -$filter = isset( $_REQUEST["filter"] ) ? $_REQUEST["filter"] : ""; -$process = isset( $_REQUEST["process"] ) ? $_REQUEST["process"] : ""; -$category = isset( $_REQUEST["category"] ) ? $_REQUEST["category"] : ""; -$status = isset( $_REQUEST["status"] ) ? strtoupper( $_REQUEST["status"] ) : ""; -$filterStatus = isset( $_REQUEST["filterStatus"] ) ? strtoupper( $_REQUEST["filterStatus"] ) : ""; -$user = isset( $_REQUEST["user"] ) ? $_REQUEST["user"] : ""; -$search = isset( $_REQUEST["search"] ) ? $_REQUEST["search"] : ""; -$action = isset( $_GET["action"] ) ? $_GET["action"] : (isset( $_REQUEST["action"] ) ? $_REQUEST["action"] : "todo"); -$type = isset( $_GET["type"] ) ? $_GET["type"] : (isset( $_REQUEST["type"] ) ? $_REQUEST["type"] : "extjs"); -$dateFrom = isset( $_REQUEST["dateFrom"] ) ? substr( $_REQUEST["dateFrom"], 0, 10 ) : ""; -$dateTo = isset( $_REQUEST["dateTo"] ) ? substr( $_REQUEST["dateTo"], 0, 10 ) : ""; -$first = isset( $_REQUEST["first"] ) ? true : false; -$openApplicationUid = (isset($_REQUEST['openApplicationUid']) && $_REQUEST['openApplicationUid'] != '')? +$sort = isset($_REQUEST["sort"]) ? $_REQUEST["sort"] : "APP_NUMBER"; +$start = isset($_REQUEST["start"]) ? $_REQUEST["start"] : "0"; +$limit = isset($_REQUEST["limit"]) ? $_REQUEST["limit"] : "25"; +$filter = isset($_REQUEST["filter"]) ? $_REQUEST["filter"] : ""; +$process = isset($_REQUEST["process"]) ? $_REQUEST["process"] : ""; +$category = isset($_REQUEST["category"]) ? $_REQUEST["category"] : ""; +$status = isset($_REQUEST["status"]) ? strtoupper($_REQUEST["status"]) : ""; +$filterStatus = isset($_REQUEST["filterStatus"]) ? strtoupper($_REQUEST["filterStatus"]) : ""; +$user = isset($_REQUEST["user"]) ? $_REQUEST["user"] : ""; +$search = isset($_REQUEST["search"]) ? $_REQUEST["search"] : ""; +$action = isset($_GET["action"]) ? $_GET["action"] : (isset($_REQUEST["action"]) ? $_REQUEST["action"] : "todo"); +$type = isset($_GET["type"]) ? $_GET["type"] : (isset($_REQUEST["type"]) ? $_REQUEST["type"] : "extjs"); +$dateFrom = isset($_REQUEST["dateFrom"]) ? substr($_REQUEST["dateFrom"], 0, 10) : ""; +$dateTo = isset($_REQUEST["dateTo"]) ? substr($_REQUEST["dateTo"], 0, 10) : ""; +$first = isset($_REQUEST["first"]) ? true : false; +$openApplicationUid = (isset($_REQUEST['openApplicationUid']) && $_REQUEST['openApplicationUid'] != '') ? $_REQUEST['openApplicationUid'] : null; -$search = (!is_null($openApplicationUid))? $openApplicationUid : $search; +$search = (!is_null($openApplicationUid)) ? $openApplicationUid : $search; if ($sort == 'CASE_SUMMARY' || $sort == 'CASE_NOTES_COUNT') { $sort = 'APP_NUMBER';//DEFAULT VALUE @@ -47,9 +47,8 @@ if ($sort == 'APP_STATUS_LABEL') { } try { - $userUid = (isset($_SESSION["USER_LOGGED"]) && $_SESSION["USER_LOGGED"] != "")? $_SESSION["USER_LOGGED"] : null; + $userUid = (isset($_SESSION["USER_LOGGED"]) && $_SESSION["USER_LOGGED"] != "") ? $_SESSION["USER_LOGGED"] : null; $result = ""; - $solrEnabled = false; switch ($action) { case "search": @@ -59,60 +58,19 @@ try { $result['data'] = array(); $result = G::json_encode($result); echo $result; - return ; + return; } - $user = ($user == "CURRENT_USER")? $userUid : $user; + $user = ($user == "CURRENT_USER") ? $userUid : $user; $userUid = $user; break; default: break; } - if (( - $action == "todo" || $action == "draft" || $action == "paused" || $action == "sent" || - $action == "selfservice" || $action == "unassigned" || $action == "search" - ) && - (($solrConf = System::solrEnv()) !== false) - ) { - G::LoadClass("AppSolr"); + G::LoadClass("applications"); + $apps = new Applications(); - $ApplicationSolrIndex = new AppSolr( - $solrConf["solr_enabled"], - $solrConf["solr_host"], - $solrConf["solr_instance"] - ); - - if ($ApplicationSolrIndex->isSolrEnabled() && $solrConf['solr_enabled'] == true) { - //Check if there are missing records to reindex and reindex them - $ApplicationSolrIndex->synchronizePendingApplications(); - $solrEnabled = true; - } else{ - $solrEnabled = false; - } - } - - if ($solrEnabled) { - $data = $ApplicationSolrIndex->getAppGridData( - $userUid, - $start, - $limit, - $action, - $filter, - $search, - $process, - $status, - $type, - $dateFrom, - $dateTo, - $callback, - $dir, - $sort, - $category - ); - } else { - G::LoadClass("applications"); - - $apps = new Applications(); + if ($action == 'search') { $data = $apps->searchAll( $userUid, $start, @@ -126,7 +84,26 @@ try { $dateFrom, $dateTo ); + } else { + $data = $apps->getAll( + $userUid, + $start, + $limit, + $action, + $filter, + $search, + $process, + $filterStatus, + $type, + $dateFrom, + $dateTo, + $callback, + $dir, + (strpos($sort, ".") !== false) ? $sort : "APP_CACHE_VIEW." . $sort, + $category + ); } + $data['data'] = \ProcessMaker\Util\DateTime::convertUtcToTimeZone($data['data']); $result = G::json_encode($data); echo $result; diff --git a/workflow/engine/methods/services/ActionsByEmailDataFormPost.php b/workflow/engine/methods/services/ActionsByEmailDataFormPost.php index ccf346019..41627bdf9 100644 --- a/workflow/engine/methods/services/ActionsByEmailDataFormPost.php +++ b/workflow/engine/methods/services/ActionsByEmailDataFormPost.php @@ -5,6 +5,30 @@ if (PMLicensedFeatures ->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0=')) { $G_PUBLISH = new Publisher(); try { + /** + * $backupSession = serialize($_SESSION); + * This script runs with $ _SESSION ['USER_LOGGED'] = '00000000000000000000000000000001', + * this action enables login as admin if you enter the url 'http://myserver.net/sysworkflow/en/neoclassic/processes/main', + * in the Browser that invoked this script. + * This action ensures that any changes to the session variables required by + * this script do not affect the main session if it exists, for example + * when multiple tabs are open. + * Serialization is used because for object types the simple assignment: + * $backupSession = $ _SESSION will not work because the assignment is by + * reference, eg: + * value = "value"; + * + * $a = ["one" => 1, "two" => $obj, "three" => 3]; + * $b = $a; + + * $a["two"]->value = "modify"; + * + * In 'b' is reflected the output of 'a'. + */ + $backupSession = serialize($_SESSION); + if ($_REQUEST['APP_UID'] == '') { if($_GET['APP_UID'] == ''){ throw new Exception('The parameter APP_UID is empty.'); @@ -146,11 +170,12 @@ if (PMLicensedFeatures throw $error; } + $_SESSION = unserialize($backupSession); $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showInfo', '', $aMessage); } catch (Exception $error) { $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', array('MESSAGE' => $error->getMessage().' Please contact to your system administrator.')); } - + $_SESSION = unserialize($backupSession); G::RenderPage('publish', 'blank'); } diff --git a/workflow/engine/methods/setup/language_Ajax.php b/workflow/engine/methods/setup/language_Ajax.php index 820c94b1c..b209f2ec5 100644 --- a/workflow/engine/methods/setup/language_Ajax.php +++ b/workflow/engine/methods/setup/language_Ajax.php @@ -153,27 +153,27 @@ try { $oDataset->next(); $aRow = $oDataset->getRow(); - if($locale != "en"){ //Default Lengage 'en' - if($locale != SYS_LANG){ //Current lenguage - //THERE IS NO ANY CASE STARTED FROM THES LANGUAGE - if ($aRow[0] == 0) { //so we can delete this language - try { - Content::removeLanguageContent( $locale ); - $trn->removeTranslationEnvironment( $locale ); - echo G::LoadTranslation( 'ID_LANGUAGE_DELETED_SUCCESSFULLY' ); - } catch (Exception $e) { - $token = strtotime("now"); + if ($locale != "en") { //Default Language 'en' + if ($locale != SYS_LANG) { //Current Language + //THERE IS NO ANY CASE STARTED FROM THIS LANGUAGE + if (empty($aRow)) { //so we can delete this language + try { + Content::removeLanguageContent($locale); + $trn->removeTranslationEnvironment($locale); + echo G::LoadTranslation('ID_LANGUAGE_DELETED_SUCCESSFULLY'); + } catch (Exception $e) { + $token = strtotime("now"); PMException::registerErrorLog($e, $token); - G::outRes( G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token)) ); - } - } else { - echo str_replace( '{0}', $aRow[0], G::LoadTranslation( 'ID_LANGUAGE_CANT_DELETE' ) ); - } - } else { - echo str_replace( '{0}', $aRow[0], G::LoadTranslation( 'ID_LANGUAGE_CANT_DELETE_CURRENTLY' ) ); - } + G::outRes(G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token))); + } + } else { + echo str_replace('{0}', $aRow['APP_TITLE'], G::LoadTranslation('ID_LANGUAGE_CANT_DELETE')); + } + } else { + echo str_replace('{0}', $aRow['APP_TITLE'], G::LoadTranslation('ID_LANGUAGE_CANT_DELETE_CURRENTLY')); + } } else { - echo str_replace( '{0}', $aRow[0], G::LoadTranslation( 'ID_LANGUAGE_CANT_DELETE_DEFAULT' ) ); + echo str_replace('{0}', $aRow['APP_TITLE'], G::LoadTranslation('ID_LANGUAGE_CANT_DELETE_DEFAULT')); } break; } diff --git a/workflow/engine/methods/setup/pluginsChange.php b/workflow/engine/methods/setup/pluginsChange.php index 687fa4ef8..581f1de7b 100644 --- a/workflow/engine/methods/setup/pluginsChange.php +++ b/workflow/engine/methods/setup/pluginsChange.php @@ -21,8 +21,6 @@ * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. */ -include_once (PATH_TRUNK."/class.Build.php"); -use Build\Utils\ProcessMakerPhpBuilderHelper; // lets display the items $pluginFile = $_GET['id']; @@ -88,16 +86,6 @@ if ($handle = opendir( PATH_PLUGINS )) { } } closedir( $handle ); - - /** - * Calls PMExtensionClass Builder to include Plugins changes. - */ - $phpBuilder = new ProcessMakerPhpBuilderHelper(); - $phpBuilder->enabledExtensions = $oPluginRegistry->getEnabledPlugins(); - if (!empty($phpBuilder->enabledExtensions)) { - $phpBuilder->extension = true; - } - $phpBuilder->buildAll(); } //$oPluginRegistry->showArrays(); diff --git a/workflow/engine/methods/users/users_Ajax.php b/workflow/engine/methods/users/users_Ajax.php index 5052db1cb..6e3961caf 100644 --- a/workflow/engine/methods/users/users_Ajax.php +++ b/workflow/engine/methods/users/users_Ajax.php @@ -179,17 +179,23 @@ try { case 'canDeleteUser': G::LoadClass('case'); $oProcessMap = new Cases(); - $USR_UID = $_POST['uUID']; + $userUid = $_POST['uUID']; $total = 0; $history = 0; - $c = $oProcessMap->getCriteriaUsersCases('TO_DO', $USR_UID); + $c = $oProcessMap->getCriteriaUsersCases('TO_DO', $userUid); $total += ApplicationPeer::doCount($c); - $c = $oProcessMap->getCriteriaUsersCases('DRAFT', $USR_UID); + $c = $oProcessMap->getCriteriaUsersCases('DRAFT', $userUid); $total += ApplicationPeer::doCount($c); - $c = $oProcessMap->getCriteriaUsersCases('COMPLETED', $USR_UID); + $c = $oProcessMap->getCriteriaUsersCases('COMPLETED', $userUid); $history += ApplicationPeer::doCount($c); - $c = $oProcessMap->getCriteriaUsersCases('CANCELLED', $USR_UID); + $c = $oProcessMap->getCriteriaUsersCases('CANCELLED', $userUid); $history += ApplicationPeer::doCount($c); + //Check if the user is configured in Web Entry + if ($total === 0) { + $webEntry = new \ProcessMaker\BusinessModel\WebEntryEvent(); + $total = $webEntry->getWebEntryRelatedToUser($userUid); + } + $response = '{success: true, candelete: '; $response .= ($total > 0) ? 'false' : 'true'; $response .= ', hashistory: '; diff --git a/workflow/engine/skinEngine/base/baseCss/ext-all-notheme.css b/workflow/engine/skinEngine/base/baseCss/ext-all-notheme.css index 7c45d7a3b..a76ba2dd0 100644 --- a/workflow/engine/skinEngine/base/baseCss/ext-all-notheme.css +++ b/workflow/engine/skinEngine/base/baseCss/ext-all-notheme.css @@ -979,8 +979,9 @@ textarea { .x-form-field-wrap { position:relative; - left:0;top:0; - text-align: left; + left:0; + top:0; + text-align: inherit; zoom:1; white-space: nowrap; } diff --git a/workflow/engine/skinEngine/base/baseCss/ext-all.css b/workflow/engine/skinEngine/base/baseCss/ext-all.css index b3c577282..d6aab37ab 100644 --- a/workflow/engine/skinEngine/base/baseCss/ext-all.css +++ b/workflow/engine/skinEngine/base/baseCss/ext-all.css @@ -979,8 +979,9 @@ textarea { .x-form-field-wrap { position:relative; - left:0;top:0; - text-align: left; + left:0; + top:0; + text-align: inherit; zoom:1; white-space: nowrap; } diff --git a/workflow/engine/skinEngine/neoclassic/baseCss/ext-all-notheme.css b/workflow/engine/skinEngine/neoclassic/baseCss/ext-all-notheme.css index bcaacfddb..bdbfeeadf 100644 --- a/workflow/engine/skinEngine/neoclassic/baseCss/ext-all-notheme.css +++ b/workflow/engine/skinEngine/neoclassic/baseCss/ext-all-notheme.css @@ -1121,7 +1121,7 @@ textarea { position: relative; left: 0; top: 0; - text-align: left; + text-align: inherit; zoom: 1; white-space: nowrap; } diff --git a/workflow/engine/skinEngine/neoclassic/baseCss/ext-all.css b/workflow/engine/skinEngine/neoclassic/baseCss/ext-all.css index 6245c1833..aa657b4ba 100644 --- a/workflow/engine/skinEngine/neoclassic/baseCss/ext-all.css +++ b/workflow/engine/skinEngine/neoclassic/baseCss/ext-all.css @@ -979,8 +979,9 @@ textarea { .x-form-field-wrap { position:relative; - left:0;top:0; - text-align: left; + left:0; + top:0; + text-align: inherit; zoom:1; white-space: nowrap; } diff --git a/workflow/engine/skinEngine/neoclassic/css/form.css b/workflow/engine/skinEngine/neoclassic/css/form.css index 27cc3887a..41e39ae91 100644 --- a/workflow/engine/skinEngine/neoclassic/css/form.css +++ b/workflow/engine/skinEngine/neoclassic/css/form.css @@ -293,7 +293,7 @@ INPUT { background-color: black; left: 0px; top: 0px; - height:100% !important; + height:auto% !important; } .panel_iframe___processmaker { width: 100%; diff --git a/workflow/engine/skinEngine/simplified/baseCss/ext-all-notheme.css b/workflow/engine/skinEngine/simplified/baseCss/ext-all-notheme.css index 01839b7c5..2cb9374b3 100644 --- a/workflow/engine/skinEngine/simplified/baseCss/ext-all-notheme.css +++ b/workflow/engine/skinEngine/simplified/baseCss/ext-all-notheme.css @@ -979,8 +979,9 @@ textarea { .x-form-field-wrap { position:relative; - left:0;top:0; - text-align: left; + left:0; + top:0; + text-align: inherit; zoom:1; white-space: nowrap; } diff --git a/workflow/engine/skinEngine/simplified/baseCss/ext-all.css b/workflow/engine/skinEngine/simplified/baseCss/ext-all.css index b3c577282..d6aab37ab 100644 --- a/workflow/engine/skinEngine/simplified/baseCss/ext-all.css +++ b/workflow/engine/skinEngine/simplified/baseCss/ext-all.css @@ -979,8 +979,9 @@ textarea { .x-form-field-wrap { position:relative; - left:0;top:0; - text-align: left; + left:0; + top:0; + text-align: inherit; zoom:1; white-space: nowrap; } diff --git a/workflow/engine/skinEngine/uxmodern/baseCss/ext-all-notheme.css b/workflow/engine/skinEngine/uxmodern/baseCss/ext-all-notheme.css index 7c45d7a3b..a76ba2dd0 100644 --- a/workflow/engine/skinEngine/uxmodern/baseCss/ext-all-notheme.css +++ b/workflow/engine/skinEngine/uxmodern/baseCss/ext-all-notheme.css @@ -979,8 +979,9 @@ textarea { .x-form-field-wrap { position:relative; - left:0;top:0; - text-align: left; + left:0; + top:0; + text-align: inherit; zoom:1; white-space: nowrap; } diff --git a/workflow/engine/skinEngine/uxmodern/baseCss/ext-all.css b/workflow/engine/skinEngine/uxmodern/baseCss/ext-all.css index 24e251a92..6fb506092 100644 --- a/workflow/engine/skinEngine/uxmodern/baseCss/ext-all.css +++ b/workflow/engine/skinEngine/uxmodern/baseCss/ext-all.css @@ -979,8 +979,9 @@ textarea { .x-form-field-wrap { position:relative; - left:0;top:0; - text-align: left; + left:0; + top:0; + text-align: inherit; zoom:1; white-space: nowrap; } diff --git a/workflow/engine/skinEngine/uxs/baseCss/ext-all-notheme.css b/workflow/engine/skinEngine/uxs/baseCss/ext-all-notheme.css index 01839b7c5..2cb9374b3 100644 --- a/workflow/engine/skinEngine/uxs/baseCss/ext-all-notheme.css +++ b/workflow/engine/skinEngine/uxs/baseCss/ext-all-notheme.css @@ -979,8 +979,9 @@ textarea { .x-form-field-wrap { position:relative; - left:0;top:0; - text-align: left; + left:0; + top:0; + text-align: inherit; zoom:1; white-space: nowrap; } diff --git a/workflow/engine/skinEngine/uxs/baseCss/ext-all.css b/workflow/engine/skinEngine/uxs/baseCss/ext-all.css index b3c577282..d6aab37ab 100644 --- a/workflow/engine/skinEngine/uxs/baseCss/ext-all.css +++ b/workflow/engine/skinEngine/uxs/baseCss/ext-all.css @@ -979,8 +979,9 @@ textarea { .x-form-field-wrap { position:relative; - left:0;top:0; - text-align: left; + left:0; + top:0; + text-align: inherit; zoom:1; white-space: nowrap; } diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php b/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php index d75a6667d..df6d214ab 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php @@ -233,7 +233,6 @@ class Cases } G::LoadClass("applications"); - $solrEnabled = false; $userUid = $dataList["userId"]; $callback = isset( $dataList["callback"] ) ? $dataList["callback"] : "stcCallback1001"; $dir = isset( $dataList["dir"] ) ? $dataList["dir"] : "DESC"; @@ -327,70 +326,30 @@ class Cases } } - if (( - $action == "todo" || $action == "draft" || $action == "paused" || $action == "sent" || - $action == "selfservice" || $action == "unassigned" || $action == "search" - ) && - (($solrConf = \System::solrEnv()) !== false) - ) { - G::LoadClass("AppSolr"); + G::LoadClass("applications"); + $apps = new \Applications(); + $result = $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 + ); - $ApplicationSolrIndex = new \AppSolr( - $solrConf["solr_enabled"], - $solrConf["solr_host"], - $solrConf["solr_instance"] - ); - - if ($ApplicationSolrIndex->isSolrEnabled() && $solrConf['solr_enabled'] == true) { - //Check if there are missing records to reindex and reindex them - $ApplicationSolrIndex->synchronizePendingApplications(); - $solrEnabled = true; - } - } - - if ($solrEnabled) { - $result = $ApplicationSolrIndex->getAppGridData( - $userUid, - $start, - $limit, - $action, - $filter, - $search, - $process, - $status, - $type, - $dateFrom, - $dateTo, - $callback, - $dir, - $sort, - $category - ); - } else { - G::LoadClass("applications"); - $apps = new \Applications(); - $result = $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 - ); - } if (!empty($result['data'])) { foreach ($result['data'] as &$value) { $value = array_change_key_case($value, CASE_LOWER); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Cases/InputDocument.php b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/InputDocument.php index 0426def6b..5e0d328a7 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Cases/InputDocument.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/InputDocument.php @@ -944,6 +944,12 @@ class InputDocument //***Validating the file allowed extensions*** $res = \G::verifyInputDocExtension($aID['INP_DOC_TYPE_FILE'], $arrayFileName[$i], $arrayFileTmpName[$i]); if ($res->status == 0) { + //The value of the variable "_label" is cleared because the file load failed. + //The validation of the die command should be improved. + if (isset($aData["APP_DATA"][$item . "_label"]) && !empty($aData["APP_DATA"][$item . "_label"])) { + unset($aData["APP_DATA"][$item . "_label"]); + $caseInstance->updateCase($appUid, $aData); + } $message = $res->message; \G::SendMessageText($message, "ERROR"); $backUrlObj = explode("sys" . SYS_SYS, $_SERVER['HTTP_REFERER']); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/EmailServer.php b/workflow/engine/src/ProcessMaker/BusinessModel/EmailServer.php index 3a88dfdc4..aa7e9e480 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/EmailServer.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/EmailServer.php @@ -473,13 +473,15 @@ class EmailServer $arrayResult[$arrayMailTestName[1]] = $this->testConnectionByStep($arrayDataAux); $arrayResult[$arrayMailTestName[1]]["title"] = \G::LoadTranslation("ID_EMAIL_SERVER_TEST_CONNECTION_VERIFYING_MAIL"); - if ((int)($arrayData["MESS_TRY_SEND_INMEDIATLY"]) == 1) { + if ((int)($arrayData["MESS_TRY_SEND_INMEDIATLY"]) == 1 && $arrayData['MAIL_TO'] != '') { $arrayResult[$arrayMailTestName[2]] = $this->testConnectionByStep($arrayData); $arrayResult[$arrayMailTestName[2]]["title"] = \G::LoadTranslation("ID_EMAIL_SERVER_TEST_CONNECTION_SENDING_EMAIL", array($arrayData["MAIL_TO"])); } break; case "PHPMAILER": - for ($step = 1; $step <= 5; $step++) { + $numSteps = ($arrayData['MAIL_TO'] != '') ? count($arrayPhpMailerTestName) : + count($arrayPhpMailerTestName) - 1; + for ($step = 1; $step <= $numSteps; $step++) { $arrayResult[$arrayPhpMailerTestName[$step]] = $this->testConnectionByStep($arrayData, $step); switch ($step) { diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Light.php b/workflow/engine/src/ProcessMaker/BusinessModel/Light.php index 2823a9172..d090fb27f 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Light.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Light.php @@ -78,6 +78,9 @@ class Light $tempTreeChild['processId'] = $processInfoChild['pro_uid']; $tempTreeChild['taskId'] = $processInfoChild['uid']; list($tempTreeChild['offlineEnabled'], $tempTreeChild['autoRoot']) = $task->getColumnValues($processInfoChild['pro_uid'], $processInfoChild['uid'], array('TAS_OFFLINE', 'TAS_AUTO_ROOT')); + //Add process category + $tempTreeChild['categoryName'] = $processInfoChild['catname']; + $tempTreeChild['categoryId'] = $processInfoChild['cat']; $forms = $task->getSteps($processInfoChild['uid']); $newForm = array(); $c = 0; diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/GranularImporter.php b/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/GranularImporter.php index 1d40a6835..80b6aba72 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/GranularImporter.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/GranularImporter.php @@ -14,6 +14,7 @@ class GranularImporter protected $factory; protected $data; + protected $regeneratedUids; /** * GranularImporter constructor. */ @@ -140,7 +141,8 @@ class GranularImporter :$data['tables']['workflow']['process'][0]['PRO_UID']; $objectList[$nameObject] = []; $objectList[$nameObject]['metadata'] = [ - 'PRJ_UID' => $prjUID + 'PRJ_UID' => $prjUID, + 'REGENERATED_UIDS' => $this->regeneratedUids ]; foreach ($data['tables']['plugins'] as $pluginKey => $pluginTable) { $key = explode(".", $pluginKey); @@ -310,7 +312,10 @@ class GranularImporter $arrayBpmnTables = $data["tables"]["bpmn"]; $arrayWorkflowTables = $data["tables"]["workflow"]; $arrayWorkflowFiles = $data["files"]["workflow"]; - $result = $this->bpmn->createFromStruct($this->structureBpmnData($arrayBpmnTables), $generateUid); + $arrayBpmnTablesFormat = $this->structureBpmnData($arrayBpmnTables); + $arrayBpmnTablesFormat['prj_type'] = $arrayWorkflowTables['process']['PRO_TYPE']; + $arrayBpmnTablesFormat['pro_status'] = $arrayWorkflowTables['process']['PRO_STATUS']; + $result = $this->bpmn->createFromStruct($arrayBpmnTablesFormat, $generateUid); $projectUidOld = $arrayBpmnTables["project"][0]["prj_uid"]; $projectUid = ($generateUid) ? $result[0]["new_uid"] : $result; if ($generateUid) { @@ -325,6 +330,7 @@ class GranularImporter $newData['tables']['workflow'] = $arrayWorkflowTables; $newData['tables']['plugins'] = isset($data["tables"]["plugins"]) ? $data["tables"]["plugins"] : []; $newData['files']['workflow'] = $arrayWorkflowFiles; + $this->regeneratedUids = $result; return array( 'data' => $newData, diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEvent.php b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEvent.php index 6dffa896b..23b8f8b03 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEvent.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntryEvent.php @@ -996,4 +996,24 @@ class WebEntryEvent throw $e; } } + + /** + * This function verify if a user $userUid was configure in a Web Entry and return the total of records + * + * @param string $userUid uid of a user + * + * return integer $total + */ + public function getWebEntryRelatedToUser($userUid) + { + try { + //Get data + $criteria = $this->getWebEntryEventCriteria(); + $criteria->add(\WebEntryEventPeer::USR_UID, $userUid, \Criteria::EQUAL); + $total = \WebEntryEventPeer::doCount($criteria); + return $total; + } catch (\Exception $e) { + throw $e; + } + } } diff --git a/workflow/engine/src/ProcessMaker/Core/RoutingScreen.php b/workflow/engine/src/ProcessMaker/Core/RoutingScreen.php index 0233b89b5..4f4e1ed41 100644 --- a/workflow/engine/src/ProcessMaker/Core/RoutingScreen.php +++ b/workflow/engine/src/ProcessMaker/Core/RoutingScreen.php @@ -2,25 +2,15 @@ namespace ProcessMaker\Core; -use AppDelegationPeer; -use Task; -use Cases; -use Criteria; -use RoutePeer; -use TaskPeer; -use G; -use ElementTaskRelationPeer; -use BpmnEventPeer; -use ResultSet; -use PMScript; -use Exception; class RoutingScreen extends \Derivation { protected $convergent; protected $divergent; public $gateway = array('PARALLEL', 'PARALLEL-BY-EVALUATION'); + public $routeType = array('SEC-JOIN', 'EVALUATE'); public $isFirst; + public $isUniqueSecJoin = false; protected $taskSecJoin; public function __construct() @@ -68,23 +58,20 @@ class RoutingScreen extends \Derivation unset($aDataMerged[$key]['USER_ASSIGNED']); $aDataMerged[$key]['DEL_PRIORITY'] = ''; foreach ($post as $i => $item) { - if(isset($post[$i]['SOURCE_UID']) && ($nextTask['NEXT_TASK']['TAS_UID'] === $post[$i]['SOURCE_UID'])){ + if (isset($post[$i]['SOURCE_UID']) && ($nextTask['NEXT_TASK']['TAS_UID'] === $post[$i]['SOURCE_UID'])) { $flagJumpTask = true; - if($post[$i]['SOURCE_UID'] === $post[$i]['TAS_UID']){ + if ($post[$i]['SOURCE_UID'] === $post[$i]['TAS_UID']) { if (isset($post[$i]['USR_UID'])) { // Multiple instances task don't send this key $aDataMerged[$key]['USR_UID'] = $post[$i]['USR_UID']; } } else { $aDataMerged[$key]['NEXT_ROUTING'][] = $post[$i]; } - if (isset($post[$i]['NEXT_TASK'])) { - $aDataMerged[$key]['NEXT_TASK'] = $post[$i]['NEXT_TASK']; - } } } } //If flagJumpTask is false the template does not Jump Intermediate Events - if(!$flagJumpTask){ + if (!$flagJumpTask) { $aDataMerged = $post; } return $aDataMerged; @@ -92,7 +79,7 @@ class RoutingScreen extends \Derivation public function prepareRoutingScreen($arrayData) { - $information = $this->prepareInformationForRoutingScreen($arrayData); + $information = $this->prepareInformation($arrayData); $response = array(); $this->taskSecJoin = array(); foreach ($information as $index => $element) { @@ -112,7 +99,7 @@ class RoutingScreen extends \Derivation } } } - if (count($response) > 1) { + if (count($response) > 1 && !$this->isUniqueSecJoin) { foreach ($response as $index => $task) { $delete = false; foreach ($this->taskSecJoin as $tj => $type) { @@ -120,7 +107,7 @@ class RoutingScreen extends \Derivation $delete = true; } } - if ($delete && $response[$index]["NEXT_TASK"]["TAS_UID"] === "-1") { + if ($delete) { unset($response[$index]); } } @@ -132,12 +119,15 @@ class RoutingScreen extends \Derivation { $outElement = $element['out']; foreach ($outElement as $indexO => $outE) { - if (!$this->isFirst && in_array($outE, $this->gateway)) { + if ((!$this->isFirst && in_array($outE, $this->gateway))) { $this->divergent[$indexO] = $outE; } if ($outE == 'SEC-JOIN' && strpos($indexO, 'itee') === false) { $this->taskSecJoin[$indexO] = $outE; } + if (in_array($outE, $this->routeType) && strpos($indexO, 'gtg') !== false) { + $this->convergent[$indexO] = $outE; + } } if (empty($element['in'])) { return true; @@ -145,211 +135,14 @@ class RoutingScreen extends \Derivation $this->isFirst = false; $inElement = $element['in']; foreach ($inElement as $indexI => $inE) { - if ($inE == 'SEC-JOIN' && strpos($indexI, 'itee') !== false) { + if (($inE == 'SEC-JOIN' && strpos($indexI, 'itee') !== false) || $inE == 'SEC-JOIN') { $this->convergent[$indexI] = $inE; } $this->checkElement($this->node[$indexI]); + if ($inE == 'SEC-JOIN' && count($inElement) == 1) { + $this->isUniqueSecJoin = true; + } } return count($this->convergent) == 0 || count($this->divergent) == 0 || count($this->convergent) == count($this->divergent); } - - - /** - * Prepares the information to show in the routing screen. - * - * @param array $arrayData Data - * @param string $taskUid Unique id of Task - * - * @return array Return array - */ - public function prepareInformationForRoutingScreen(array $arrayData, $taskUid = "") - { - try { - if (!class_exists("Cases")) { - G::LoadClass("case"); - } - - $this->case = new Cases(); - $task = new Task(); - - $arrayApplicationData = $this->case->loadCase($arrayData["APP_UID"]); - - $arrayNextTask = array(); - $arrayNextTaskDefault = array(); - $i = 0; - - $criteria = new Criteria("workflow"); - - $criteria->addSelectColumn(RoutePeer::TAS_UID); - $criteria->addSelectColumn(RoutePeer::ROU_NEXT_TASK); - $criteria->addSelectColumn(RoutePeer::ROU_TYPE); - $criteria->addSelectColumn(RoutePeer::ROU_DEFAULT); - $criteria->addSelectColumn(RoutePeer::ROU_CONDITION); - - if ($taskUid != "") { - $criteria->add(\RoutePeer::TAS_UID, $taskUid, Criteria::EQUAL); - $criteria->addAscendingOrderByColumn(RoutePeer::ROU_CASE); - - $rsCriteria = RoutePeer::doSelectRS($criteria); - } else { - $criteria->addJoin(AppDelegationPeer::TAS_UID, TaskPeer::TAS_UID, Criteria::LEFT_JOIN); - $criteria->addJoin(AppDelegationPeer::TAS_UID, RoutePeer::TAS_UID, Criteria::LEFT_JOIN); - $criteria->add(AppDelegationPeer::APP_UID, $arrayData["APP_UID"], Criteria::EQUAL); - $criteria->add(AppDelegationPeer::DEL_INDEX, $arrayData["DEL_INDEX"], Criteria::EQUAL); - $criteria->addAscendingOrderByColumn(\RoutePeer::ROU_CASE); - - $rsCriteria = \AppDelegationPeer::doSelectRS($criteria); - } - - $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); - - $flagDefault = false; - $aSecJoin = array(); - $count = 0; - - while ($rsCriteria->next()) { - $arrayRouteData = G::array_merges($rsCriteria->getRow(), $arrayData); - - if ((int)($arrayRouteData["ROU_DEFAULT"]) == 1) { - $arrayNextTaskDefault = $arrayRouteData; - $flagDefault = true; - continue; - } - - $flagAddDelegation = true; - - //Evaluate the condition if there are conditions defined - if (trim($arrayRouteData["ROU_CONDITION"]) != "" && $arrayRouteData["ROU_TYPE"] != "SELECT") { - G::LoadClass("pmScript"); - - $pmScript = new PMScript(); - $pmScript->setFields($arrayApplicationData["APP_DATA"]); - $pmScript->setScript($arrayRouteData["ROU_CONDITION"]); - $flagAddDelegation = $pmScript->evaluate(); - } - - if (trim($arrayRouteData['ROU_CONDITION']) == '' && $arrayRouteData['ROU_NEXT_TASK'] != '-1') { - $arrayTaskData = $task->load($arrayRouteData['ROU_NEXT_TASK']); - - if ($arrayRouteData['ROU_TYPE'] != 'SEC-JOIN' && $arrayTaskData['TAS_TYPE'] == 'GATEWAYTOGATEWAY') { - $flagAddDelegation = true; - } - - if($arrayRouteData['ROU_TYPE'] == 'SEC-JOIN'){ - $aSecJoin[$count]['ROU_PREVIOUS_TASK'] = $arrayRouteData['ROU_NEXT_TASK']; - $aSecJoin[$count]['ROU_PREVIOUS_TYPE'] = 'SEC-JOIN'; - $count++; - } - } - - if ($arrayRouteData['ROU_TYPE'] == 'EVALUATE' && !empty($arrayNextTask)) { - $flagAddDelegation = false; - } - - if ($flagAddDelegation && - preg_match("/^(?:EVALUATE|PARALLEL-BY-EVALUATION)$/", $arrayRouteData["ROU_TYPE"]) && - trim($arrayRouteData["ROU_CONDITION"]) == "" - ) { - $flagAddDelegation = false; - } - - if ($flagAddDelegation) { - $arrayNextTask[++$i] = $this->prepareInformationTask($arrayRouteData); - } - } - - if (count($arrayNextTask) == 0 && count($arrayNextTaskDefault) > 0) { - $arrayNextTask[++$i] = $this->prepareInformationTask($arrayNextTaskDefault); - } - - //Check Task GATEWAYTOGATEWAY, END-MESSAGE-EVENT, END-EMAIL-EVENT - $arrayNextTaskBackup = $arrayNextTask; - - $arrayNextTask = array(); - $i = 0; - foreach ($arrayNextTaskBackup as $value) { - $arrayNextTaskData = $value; - $this->node[$value['TAS_UID']]['out'][$value['ROU_NEXT_TASK']] = $value['ROU_TYPE']; - if ($arrayNextTaskData["NEXT_TASK"]["TAS_UID"] != "-1" && - preg_match("/^(?:" . $this->regexpTaskTypeToInclude . ")$/", $arrayNextTaskData["NEXT_TASK"]["TAS_TYPE"]) - ) { - $arrayAux = $this->prepareInformationForRoutingScreen($arrayData, $arrayNextTaskData["NEXT_TASK"]["TAS_UID"]); - $this->node[$value['ROU_NEXT_TASK']]['in'][$value['TAS_UID']] = $value['ROU_TYPE']; - $notShowNextTaskWhenJoinOf = "INTERMEDIATE-THROW-MESSAGE-EVENT|INTERMEDIATE-CATCH-MESSAGE-EVENT|SCRIPT-TASK|INTERMEDIATE-CATCH-TIMER-EVENT|INTERMEDIATE-THROW-EMAIL-EVENT"; - - foreach ($arrayAux as $value2) { - - //@TODO move this logic to the prepareInformation of the Derivation class - $intermediateEventAndJoinPresent = (array_key_exists('TAS_TYPE', $value2) - && array_key_exists('ROU_TYPE', $value2) - && preg_match("/^(?:" . $notShowNextTaskWhenJoinOf . ")$/", $value2["TAS_TYPE"]) - && $value2['ROU_TYPE'] === 'SEC-JOIN'); - if (!$intermediateEventAndJoinPresent) { - $key = ++$i; - $arrayNextTask[$key] = $value2; - $prefix = substr($value['ROU_NEXT_TASK'], 0, 4); - if ($prefix!=='gtg-') { - $arrayNextTask[$key]['SOURCE_UID'] = $value['ROU_NEXT_TASK']; - } - foreach ($aSecJoin as $rsj) { - $arrayNextTask[$i]["NEXT_TASK"]["ROU_PREVIOUS_TASK"] = $rsj["ROU_PREVIOUS_TASK"]; - $arrayNextTask[$i]["NEXT_TASK"]["ROU_PREVIOUS_TYPE"] = "SEC-JOIN"; - } - } - } - } else { - $regexpTaskTypeToInclude = "END-MESSAGE-EVENT|END-EMAIL-EVENT|INTERMEDIATE-THROW-EMAIL-EVENT"; - - if ($arrayNextTaskData["NEXT_TASK"]["TAS_UID"] == "-1" && - preg_match("/^(?:" . $regexpTaskTypeToInclude . ")$/", $arrayNextTaskData["TAS_TYPE"]) - ) { - $arrayNextTaskData["NEXT_TASK"]["TAS_UID"] = $arrayNextTaskData["TAS_UID"] . "/" . $arrayNextTaskData["NEXT_TASK"]["TAS_UID"]; - } - $prefix = substr($value['ROU_NEXT_TASK'], 0, 4); - if($prefix!=='gtg-'){ - $arrayNextTaskData['SOURCE_UID'] = $value['ROU_NEXT_TASK']; - } - $arrayNextTask[++$i] = $arrayNextTaskData; - foreach($aSecJoin as $rsj){ - $arrayNextTask[$i]["NEXT_TASK"]["ROU_PREVIOUS_TASK"] = $rsj["ROU_PREVIOUS_TASK"]; - $arrayNextTask[$i]["NEXT_TASK"]["ROU_PREVIOUS_TYPE"] = "SEC-JOIN"; - } - //Start-Timer with Script-task - $criteriaE = new Criteria("workflow"); - $criteriaE->addSelectColumn(ElementTaskRelationPeer::ELEMENT_UID); - $criteriaE->addJoin(BpmnEventPeer::EVN_UID, ElementTaskRelationPeer::ELEMENT_UID, Criteria::LEFT_JOIN); - $criteriaE->add(ElementTaskRelationPeer::TAS_UID, $arrayNextTaskData["TAS_UID"], Criteria::EQUAL); - $criteriaE->add(BpmnEventPeer::EVN_TYPE, 'START', Criteria::EQUAL); - $criteriaE->add(BpmnEventPeer::EVN_MARKER, 'TIMER', Criteria::EQUAL); - $rsCriteriaE = AppDelegationPeer::doSelectRS($criteriaE); - $rsCriteriaE->setFetchmode(ResultSet::FETCHMODE_ASSOC); - while ($rsCriteriaE->next()) { - if($arrayNextTaskData["NEXT_TASK"]["TAS_TYPE"] == "SCRIPT-TASK"){ - if(isset($arrayNextTaskData["NEXT_TASK"]["USER_ASSIGNED"]["USR_UID"]) && $arrayNextTaskData["NEXT_TASK"]["USER_ASSIGNED"]["USR_UID"] == ""){ - $useruid = "00000000000000000000000000000001"; - $userFields = $this->getUsersFullNameFromArray( $useruid ); - $arrayNextTask[$i]["NEXT_TASK"]["USER_ASSIGNED"] = $userFields; - } - } - } - } - } - - //1. There is no rule - if (empty($arrayNextTask)) { - $bpmn = new \ProcessMaker\Project\Bpmn(); - - throw new Exception(G::LoadTranslation( - 'ID_NO_DERIVATION_' . (($bpmn->exists($arrayApplicationData['PRO_UID']))? 'BPMN_RULE' : 'RULE') - )); - } - - //Return - return $arrayNextTask; - } catch (Exception $e) { - throw $e; - } - } - - -} \ No newline at end of file +} diff --git a/workflow/engine/src/ProcessMaker/Importer/Importer.php b/workflow/engine/src/ProcessMaker/Importer/Importer.php index 701f3e326..f3d946fa5 100644 --- a/workflow/engine/src/ProcessMaker/Importer/Importer.php +++ b/workflow/engine/src/ProcessMaker/Importer/Importer.php @@ -14,6 +14,7 @@ abstract class Importer protected $filename = ""; protected $saveDir = ""; protected $metadata = array(); + protected $prjCreateUser = ''; /** * Title of the process before being updated/deleted. * @var string @@ -494,6 +495,7 @@ abstract class Importer $project["diagrams"] = array($diagram); $project["prj_author"] = isset($this->data["usr_uid"])? $this->data["usr_uid"]: "00000000000000000000000000000001"; $project["process"] = $tables["process"][0]; + $project["prjCreateUser"] = $this->prjCreateUser; return Adapter\BpmnWorkflow::createFromStruct($project, $generateUid); } @@ -761,7 +763,7 @@ abstract class Importer } } - public function saveAs($prj_uid, $prj_name, $prj_description, $prj_category) + public function saveAs($prj_uid, $prj_name, $prj_description, $prj_category, $prj_user = '') { try { $exporter = new \ProcessMaker\Exporter\XmlExporter($prj_uid); @@ -779,6 +781,7 @@ abstract class Importer $this->setSourceFile($outputFilename); $this->prepare(); + $this->prjCreateUser = $prj_user; $this->importData["tables"]["bpmn"]["project"][0]["prj_name"] = $prj_name; $this->importData["tables"]["bpmn"]["project"][0]["prj_description"] = $prj_description; $this->importData["tables"]["bpmn"]["diagram"][0]["dia_name"] = $prj_name; diff --git a/workflow/engine/src/ProcessMaker/Project/Adapter/BpmnWorkflow.php b/workflow/engine/src/ProcessMaker/Project/Adapter/BpmnWorkflow.php index 869dbdd16..1205fa62b 100644 --- a/workflow/engine/src/ProcessMaker/Project/Adapter/BpmnWorkflow.php +++ b/workflow/engine/src/ProcessMaker/Project/Adapter/BpmnWorkflow.php @@ -90,6 +90,14 @@ class BpmnWorkflow extends Project\Bpmn $wpData["PRO_ID"] = $data["PRO_ID"]; } + if (array_key_exists("PRO_STATUS", $data)) { + $wpData["PRO_STATUS"] = $data["PRO_STATUS"]; + } + + if (array_key_exists("PRO_CREATE_USER", $data)) { + $wpData["PRO_CREATE_USER"] = $data["PRO_CREATE_USER"]; + } + $this->wp = new Project\Workflow(); $this->wp->create($wpData); @@ -1310,6 +1318,14 @@ class BpmnWorkflow extends Project\Bpmn $data["PRO_ID"] = $projectData["process"]["pro_id"]; } + if (isset($projectData['pro_status'])) { + $data["PRO_STATUS"] = $projectData['pro_status']; + } + + if (isset($projectData['prjCreateUser'])){ + $data["PRO_CREATE_USER"] = $projectData['prjCreateUser']; + } + $bwp->create($data); $diagramData = $processData = array(); diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Project.php b/workflow/engine/src/ProcessMaker/Services/Api/Project.php index 6c080741c..78114a200 100644 --- a/workflow/engine/src/ProcessMaker/Services/Api/Project.php +++ b/workflow/engine/src/ProcessMaker/Services/Api/Project.php @@ -221,7 +221,7 @@ class Project extends Api public function doSaveAs($prj_uid, $prj_name, $prj_description = null, $prj_category = null) { $importer = new \ProcessMaker\Importer\XmlImporter(); - return $importer->saveAs($prj_uid, $prj_name, $prj_description, $prj_category); + return $importer->saveAs($prj_uid, $prj_name, $prj_description, $prj_category, $this->getUserId()); } /** diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Project/OutputDocuments.php b/workflow/engine/src/ProcessMaker/Services/Api/Project/OutputDocuments.php index 74af56924..5e8231b04 100644 --- a/workflow/engine/src/ProcessMaker/Services/Api/Project/OutputDocuments.php +++ b/workflow/engine/src/ProcessMaker/Services/Api/Project/OutputDocuments.php @@ -78,10 +78,10 @@ class OutputDocuments extends Api * * @param string $prjUid {@min 32} {@max 32} * @param string $outputDocumentUid {@min 32} {@max 32} - * @param OutputDocumentStructure $request_data + * @param array $request_data * */ - public function doPutProjectOutputDocument($prjUid, $outputDocumentUid, OutputDocumentStructure $request_data) + public function doPutProjectOutputDocument($prjUid, $outputDocumentUid, $request_data) { try { $request_data = (array)($request_data); diff --git a/workflow/engine/templates/cases/main.js b/workflow/engine/templates/cases/main.js index cee5b829a..a025d78aa 100644 --- a/workflow/engine/templates/cases/main.js +++ b/workflow/engine/templates/cases/main.js @@ -1,28 +1,24 @@ var PANEL_EAST_OPEN = false; -var currentSelectedTreeMenuItem = null; var centerPanel; -var menuTree, setFlag; +var setFlag; var flagRefresh = true; - var debugVarTpl = new Ext.Template('{value}'); -debugVarTpl.compile(); - var detailsText = ''; - var debugTriggersDetailTpl = new Ext.Template('
{code}
'); -debugTriggersDetailTpl.compile(); - var propStore; var triggerStore; - -var debugVariablesFilter; -var NOTIFIER_FLAG = false; var result; var _action = ''; -var _CASE_TITLE; //@var treeMenuItemsLoaded -> added to flag the "treeMenuItems" tree, to ensure that its onload event is executed just once var treeMenuItemsLoaded = false; +debugVarTpl.compile(); +debugTriggersDetailTpl.compile(); + +setFlag = function (val) { + flagRefresh = val; +}; + Ext.onReady(function(){ new Ext.KeyMap(document, { key: Ext.EventObject.F5, @@ -35,7 +31,6 @@ Ext.onReady(function(){ updateCasesTree(); } else - //Ext.Msg.alert('Refresh', 'You clicked: CTRL-F5'); Ext.Msg.alert(_('ID_REFRESH_LABEL'),_('ID_REFRESH_MESSAGE')); } }); @@ -46,119 +41,17 @@ Ext.onReady(function(){ var resetGrid = function() { propStore.load(); }; + var resetTriggers = function(){ + triggerStore.load(); + }; var debugVariablesFilterDynaform = function(){ propStore.load({params:{filter:'dyn'}}); - } + }; var debugVariablesFilterSystem = function(){ propStore.load({params:{filter:'sys'}}); - } - - var resetTriggers = function(){ - triggerStore.load(); - } - - propStore = new Ext.data.Store({ - proxy: new Ext.data.HttpProxy({url: 'debug_vars'}), - reader: new Ext.data.DynamicJsonReader({root: 'data'}) - }); - - propStore.on('load', function(){ - propStore.fields = propStore.recordType.prototype.fields; - debugVariables.setSource(propStore.getAt(0).data); - }); - - - var debugVariables = new Ext.grid.PropertyGrid({ - id: 'debugVariables', - title:TRANSLATIONS.ID_VARIABLES, - autoHeight: false, - height: 300, - width: 400, - region: 'center', - margins: '2 2 0 2', - - border: true, - stripeRows: true, - listeners: { - beforeedit: function(event) { //Cancel editing - read only - event.cancel = true; - } - }, - tbar: [ - {text: TRANSLATIONS.ID_ALL, handler: resetGrid}, - {text: TRANSLATIONS.ID_DYNAFORM, handler: debugVariablesFilterDynaform}, - {text: TRANSLATIONS.ID_SYSTEM, handler: debugVariablesFilterSystem} - ], - sm: new Ext.grid.RowSelectionModel({singleSelect: true}), - viewConfig: { - forceFit: true - } - - }); - - //set debug variable details - debugVariables.getSelectionModel().on('rowselect', function(sm, rowIdx, r) { - var detailPanel = Ext.getCmp('debug-details-panel'); - var d = {} - - d.name = r.data.name; - d.value = parent.parent.htmlentities ? parent.parent.htmlentities(r.data.value) : r.data.value; - - debugVarTpl.overwrite(detailPanel.body, d); - detailPanel.setTitle(r.data.name); - - if(r.data.value == '' || r.data.value == '' ){ - Ext.getCmp('deatachAction').setDisabled(false); - Ext.Ajax.request({ - url: 'debug_vars?r='+Math.random(), - success: function(response){ - try{ - result = eval('('+response.responseText+')'); - - var store1a = new Ext.data.ArrayStore({fields: result.headers}); - // manually load local data - store1a.loadData(result.rows); - - var myGridPanel = new Ext.grid.GridPanel({ - store: store1a, - height: 200, - border : false, - columns: result.columns, - stripeRows : true, - layout: 'fit', - viewConfig:{forceFit:true, scrollOffset:0}, - listeners: { - rowdblclick: function(grid, n,e){ - - }, - render: function(){ - this.loadMask = new Ext.LoadMask(this.body, { msg:_('ID_LOADING_GRID') }); - } - } - }); - - Ext.each(detailPanel.items.items, function(childPanel) { - detailPanel.remove(childPanel, true); - - }); - - detailPanel.add(myGridPanel); - detailPanel.doLayout(); - } catch (e){ - //alert(""+e); - } - }, - failure: function(){}, - params: {request: 'getRows', fieldname:r.data.name} - }); - - - } else - Ext.getCmp('deatachAction').setDisabled(true); - - }); + }; //center iframe panel centerPanel = { @@ -169,7 +62,7 @@ Ext.onReady(function(){ id : 'casesSubFrame' }, deferredRender: false - } + }; /** * Menu Panel @@ -200,32 +93,8 @@ Ext.onReady(function(){ if( tp.attributes.url ){ document.getElementById('casesSubFrame').src = tp.attributes.url; } - } , - 'render': function(tp){ - /*tp.getSelectionModel().on('selectionchange', function(tree, node){ - - if( node.attributes.url ){ - document.getElementById('casesSubFrame').src = node.attributes.url; - } - //var el = Ext.getCmp('details-panel').body; - if(node.attributes.tagName == 'option' && node.attributes.cases_count ){ - ReloadTreeMenuItemDetail({item:node.attributes.id}); - currentSelectedTreeMenuItem = node.attributes.id; - Ext.getCmp('tree_menuItem_detail').setTitle(node.attributes.title.toUpperCase() + ' - Related processes: '+node.attributes.processes_count); - } else { - //el.update(detailsText); - Ext.getCmp('tree_menuItem_detail').setTitle(''); - currentSelectedTreeMenuItem = null; - ReloadTreeMenuItemDetail({item:''}); - } - })*/ - - }/*, - 'afterrender': { - fn: setNode, - scope: this - }*/ - + }, + 'render': function(tp){} } }); @@ -241,13 +110,13 @@ Ext.onReady(function(){ updateCasesTree(); } - if( _nodeId != '' ){ - treePanel1 = Ext.getCmp('tree-panel') + if(_nodeId !== ''){ + treePanel1 = Ext.getCmp('tree-panel'); if(treePanel1) node = treePanel1.getNodeById(_nodeId); if(node) { node.select(); - if (_nodeId == 'CASES_START_CASE') { + if (_nodeId === 'CASES_START_CASE') { updateCasesTree(); } } @@ -286,6 +155,102 @@ Ext.onReady(function(){ }); mainMenu.setTitle("
"); + propStore = new Ext.data.Store({ + proxy: new Ext.data.HttpProxy({url: 'debug_vars'}), + reader: new Ext.data.DynamicJsonReader({root: 'data'}) + }); + + propStore.on('load', function(){ + propStore.fields = propStore.recordType.prototype.fields; + debugVariables.setSource(propStore.getAt(0).data); + }); + + /** + * Triggers Panel + */ + var debugVariables = new Ext.grid.PropertyGrid({ + id: 'debugVariables', + title:TRANSLATIONS.ID_VARIABLES, + autoHeight: false, + height: 300, + width: 400, + region: 'center', + margins: '2 2 0 2', + border: true, + stripeRows: true, + listeners: { + beforeedit: function(event) { //Cancel editing - read only + event.cancel = true; + } + }, + tbar: [ + {text: TRANSLATIONS.ID_ALL, handler: resetGrid}, + {text: TRANSLATIONS.ID_DYNAFORM, handler: debugVariablesFilterDynaform}, + {text: TRANSLATIONS.ID_SYSTEM, handler: debugVariablesFilterSystem} + ], + sm: new Ext.grid.RowSelectionModel({singleSelect: true}), + viewConfig: { + forceFit: true + } + }); + + //set debug variable details + debugVariables.getSelectionModel().on('rowselect', function(sm, rowIdx, r) { + var detailPanel = Ext.getCmp('debug-details-panel'), + d = {}; + d.name = r.data.name; + d.value = parent.parent.htmlentities ? parent.parent.htmlentities(r.data.value) : r.data.value; + debugVarTpl.overwrite(detailPanel.body, d); + detailPanel.setTitle(r.data.name); + + if(r.data.value === '' || r.data.value === '' ){ + Ext.getCmp('deatachAction').setDisabled(false); + Ext.Ajax.request({ + url: 'debug_vars?r='+Math.random(), + success: function(response){ + try{ + result = eval('('+response.responseText+')'); + + var store1a = new Ext.data.ArrayStore({fields: result.headers}); + // manually load local data + store1a.loadData(result.rows); + + var myGridPanel = new Ext.grid.GridPanel({ + store: store1a, + height: 200, + border : false, + columns: result.columns, + stripeRows : true, + layout: 'fit', + viewConfig:{forceFit:true, scrollOffset:0}, + listeners: { + rowdblclick: function(grid, n,e){ + + }, + render: function(){ + this.loadMask = new Ext.LoadMask(this.body, { msg:_('ID_LOADING_GRID') }); + } + } + }); + + Ext.each(detailPanel.items.items, function(childPanel) { + detailPanel.remove(childPanel, true); + }); + + detailPanel.add(myGridPanel); + detailPanel.doLayout(); + } catch (e){ + + } + }, + failure: function(){}, + params: {request: 'getRows', fieldname:r.data.name} + }); + } else + Ext.getCmp('deatachAction').setDisabled(true); + + }); + /** * Triggers Panel */ @@ -307,22 +272,14 @@ Ext.onReady(function(){ triggerStore = new Ext.data.GroupingStore({ reader: reader, - sortInfo:{field: 'name', direction: "ASC"}, groupField:'execution_time', groupDir: 'DESC', - proxy: new Ext.data.HttpProxy({url: 'debug_triggers?r='+Math.random()}), - listeners: { - load : function() { - var detailPanel = Ext.getCmp('debug-details-panel'); - detailPanel.setTitle(''); - debugTriggersDetailTpl.overwrite(detailPanel.body, {}); - } - } + proxy: new Ext.data.HttpProxy({url: 'debug_triggers?r='+Math.random()}) }); var debugTriggers = new xg.GridPanel({ + id: 'debugTriggers', store: triggerStore, - columns: [ {id:'name',header: _('ID_NAME'), width: 60, sortable: true, dataIndex: 'name'}, {header: _('ID_EXECUTION'), width: 30, sortable: true, dataIndex: 'execution_time'}, @@ -338,15 +295,12 @@ Ext.onReady(function(){ width: 700, height: 450, title: TRANSLATIONS.ID_TRIGGERS, - /*tbar: [ - {text: TRANSLATIONS.ID_OPEN_IN_POPUP, handler: triggerWindow} - ],*/ sm: new Ext.grid.RowSelectionModel({singleSelect: true}), viewConfig: { forceFit: true }, listeners: { - rowdblclick: function(grid, n,e){ + rowdblclick: function(grid, n,e) { triggerWindow(); } } @@ -355,32 +309,31 @@ Ext.onReady(function(){ debugTriggers.getSelectionModel().on('rowselect', function(sm, rowIdx, r) { Ext.getCmp('deatachAction').setDisabled(false); var detailPanel = Ext.getCmp('debug-details-panel'); - detailPanel.setTitle(r.data.name); debugTriggersDetailTpl.overwrite(detailPanel.body, r.data); + detailPanel.setTitle(r.data.name); }); function triggerWindow() { var r = debugTriggers.getSelectionModel().getSelected(); - if(r){ - var w = new Ext.Window({ - title: r.data.name, - width: 500, - height: 400, - modal: true, - autoScroll: true, - maximizable: true, - items: [], - listeners:{ - show:function() { - this.loadMask = new Ext.LoadMask(this.body, { msg:_('ID_LOADING') }); - } - } - }); - w.show(); - - debugTriggersDetailTpl.overwrite(w.body, r.data); + if(r) { + var w = new Ext.Window({ + title: r.data.name, + width: 500, + height: 400, + modal: true, + autoScroll: true, + maximizable: true, + items: [], + listeners:{ + show: function() { + this.loadMask = new Ext.LoadMask(this.body, { msg:_('ID_LOADING') }); + } + } + }); + w.show(); + debugTriggersDetailTpl.overwrite(w.body, r.data); } - }; + } debugPanel = new Ext.Panel({ @@ -404,7 +357,6 @@ Ext.onReady(function(){ tabPosition: 'top', region:'center', split: true, - //height:detailsdebugVariablesHeight, items: [ debugVariables, debugTriggers @@ -413,7 +365,10 @@ Ext.onReady(function(){ beforetabchange: function(){ Ext.getCmp('deatachAction').setDisabled(true); Ext.getCmp('debug-details-panel').html = ''; - } + }, + tabchange: function (tabpanel, tab) { + clearItemSelected(tab.id); + } } }), { @@ -426,7 +381,6 @@ Ext.onReady(function(){ split: true, margins: '0 2 2 2', cmargins: '2 2 2 2', - //height: detailsMenuTreePanelHeight, height: 50, html: detailsText, tbar:[ @@ -437,11 +391,11 @@ Ext.onReady(function(){ text: _('ID_OPEN_IN_A_NEW_WINDOW'), iconCls: 'ss_sprite ss_application_form', handler: function(){ - if( Ext.getCmp('debugPanelTabs').getActiveTab().id == 'debugVariables' ){ - var store1a = new Ext.data.ArrayStore({fields: result.headers}); + if( Ext.getCmp('debugPanelTabs').getActiveTab().id === 'debugVariables' ){ + var i, + store1a = new Ext.data.ArrayStore({fields: result.headers}); store1a.loadData(result.rows); - - for(i=0; i'; - //NOTIFIER_FLAG = true; } else { - //if(NOTIFIER_FLAG === false){ document.getElementById('NOTIFIER_' + result[i].item).innerHTML = result[i].count; - //} } } else continue; @@ -558,12 +533,7 @@ function updateCasesTree() { }); } -setFlag = function (val) { - flagRefresh = val; -} - -function timer() -{ +function timer() { if (flagRefresh) { updateCasesTree(); updateCasesView(); @@ -694,10 +664,6 @@ Ext.app.menuLoader = Ext.extend(Ext.ux.tree.XmlTreeLoader, { } }); -function setDefaultOption(){ - //document.getElementById('casesSubFrame').src = "casesListExtJs"; -} - var notify = function(title, msg){ PMExt.notify(title, msg); -} +}; diff --git a/workflow/engine/templates/installer/installer_cards.js b/workflow/engine/templates/installer/installer_cards.js index 94409b8e1..a754ce411 100644 --- a/workflow/engine/templates/installer/installer_cards.js +++ b/workflow/engine/templates/installer/installer_cards.js @@ -744,6 +744,10 @@ Ext.onReady(function(){ id: 'adminPassword', enableKeyEvents: true, allowBlank: false, + validator: function (v) { + v = v.trim(); + return !/^\s+$/.test(v); + }, listeners: {keyup: function() { wizard.onClientValidation(4, false); }} @@ -755,6 +759,10 @@ Ext.onReady(function(){ id : 'confirmPassword', enableKeyEvents: true, allowBlank: false, + validator: function (v) { + v = v.trim(); + return !/^\s+$/.test(v.trim()); + }, listeners: {keyup: function() { wizard.onClientValidation(4, false); }} diff --git a/workflow/engine/templates/processes/main.js b/workflow/engine/templates/processes/main.js index d5630ec97..f2580a500 100644 --- a/workflow/engine/templates/processes/main.js +++ b/workflow/engine/templates/processes/main.js @@ -388,7 +388,13 @@ Ext.onReady(function(){ exportImportProcessObjects('export'); } } - ] + ], + listeners: { + "click": function (obj, e) + { + obj.showMenu(); + } + } }; exportProcessOption = granularExportProcessOption; } else { diff --git a/workflow/engine/templates/processes/webentryPost.tpl b/workflow/engine/templates/processes/webentryPost.tpl index 85c80bee2..079bf370e 100644 --- a/workflow/engine/templates/processes/webentryPost.tpl +++ b/workflow/engine/templates/processes/webentryPost.tpl @@ -153,7 +153,7 @@ try { $result = ws_routeCase($caseId, 1); $assign = $result->message; - $aMessage["MESSAGE"] = "
Case created in ProcessMaker
Case Number: $caseNr
Case Id: $caseId
Case derivated to: $assign"; + $aMessage["MESSAGE"] = "
Case created in ProcessMaker
Case Number: $caseNr
Case Id: $caseId
Case routed to: $assign"; } else { $aMessage["MESSAGE"] = " An error occurred while the application was being processed.
diff --git a/workflow/engine/templates/services/login_getStarted.html b/workflow/engine/templates/services/login_getStarted.html index baac5bc14..243b00080 100644 --- a/workflow/engine/templates/services/login_getStarted.html +++ b/workflow/engine/templates/services/login_getStarted.html @@ -44,6 +44,7 @@ span.cMargLeft { padding-left: 20; } .cell2 { + vertical-align: middle; font-size: 13px; background: #fff; border-right: #fff 1px solid; @@ -95,8 +96,7 @@

Welcome to ProcessMaker


-

This new version features a new process designer based upon the Business Process Management Notation 2 standard. It offers a new form designer with flexible layouts for desktops, tablets and cellphones and a new REST API to remotely access ProcessMaker.

-

To get started, log in using the following credentials. You can change them later:

+

To get started log in using the following credentials:

Username: {name}
Password: {pass}

We suggest you follow our 7 easy videos to automate your workflow. You can see a demo of each step at http://www.processmaker.com/tutorials/

diff --git a/workflow/engine/templates/setup/newSite.js b/workflow/engine/templates/setup/newSite.js index 7306a1c56..8d08c7164 100644 --- a/workflow/engine/templates/setup/newSite.js +++ b/workflow/engine/templates/setup/newSite.js @@ -100,7 +100,11 @@ Ext.onReady(function(){ inputType:'password', value:'admin', width: 200, - allowBlank: false + allowBlank: false, + validator: function (v) { + v = v.trim(); + return !/^\s+$/.test(v); + } }, { id: 'NW_PASSWORD2', @@ -109,7 +113,11 @@ Ext.onReady(function(){ inputType:'password', value:'admin', width: 200, - allowBlank: false + allowBlank: false, + validator: function (v) { + v = v.trim(); + return !/^\s+$/.test(v); + } } ] }); @@ -173,11 +181,9 @@ Ext.onReady(function(){ aoDbRb =aoDbWf; aoDbRp =aoDbWf; nwUsername =formNewSite.getForm().findField('NW_USERNAME').getValue(); - nwPassword =formNewSite.getForm().findField('NW_PASSWORD').getValue(); - nwPassword2=formNewSite.getForm().findField('NW_PASSWORD2').getValue(); + nwPassword = formNewSite.getForm().findField('NW_PASSWORD').getValue().trim(); + nwPassword2 = formNewSite.getForm().findField('NW_PASSWORD2').getValue().trim(); aoDbDrop=formNewSite.getForm().findField('AO_DB_DROP').getValue(); - //Ext.getCmp('NW_TITLE').disable()=true; - //Ext.getCmp('NW_TITLE').readOnly = true; createNW(nwTitle, aoDbWf, aoDbRb, aoDbRp, nwUsername, nwPassword, nwPassword2); }, failure: function(f,a){ diff --git a/workflow/engine/templates/users/users.js b/workflow/engine/templates/users/users.js index 07d911864..38bd1a514 100644 --- a/workflow/engine/templates/users/users.js +++ b/workflow/engine/templates/users/users.js @@ -116,20 +116,6 @@ Ext.onReady(function () { width : 400 } -/* - ,{ - xtype: 'fileuploadfield', - id: 'USR_RESUME', - emptyText: _('ID_PLEASE_SELECT_FILE'), - fieldLabel: _('ID_RESUME'), - name: 'USR_RESUME', - buttonText: '', - width: 260, - buttonCfg:{ - iconCls: 'upload-icon' - } - } -*/ ] }); @@ -308,8 +294,9 @@ Ext.onReady(function () { var dateField = new Ext.form.DateField({ id : "USR_DUE_DATE", - fieldLabel : _("ID_EXPIRATION_DATE"), + fieldLabel : ' * ' + _("ID_EXPIRATION_DATE"), format : "Y-m-d", + allowBlank:false, editable : true, width : 120, value : (new Date().add(Date.YEAR, EXPIRATION_DATE)).format("Y-m-d") @@ -1205,8 +1192,8 @@ function validateUserName() { function userFrmEditSubmit() { - if (typeof(usertmp) != "undefined" && - usertmp.REPLACED_NAME == frmDetails.getForm().findField("USR_REPLACED_BY").getRawValue() + if (typeof(usertmp) !== "undefined" && + usertmp.REPLACED_NAME === frmDetails.getForm().findField("USR_REPLACED_BY").getRawValue() ) { frmDetails.getForm().findField("USR_REPLACED_BY").setValue(usertmp.USR_REPLACED_BY); frmDetails.getForm().findField("USR_REPLACED_BY").setRawValue(usertmp.REPLACED_NAME); diff --git a/workflow/public_html/.htaccess b/workflow/public_html/.htaccess index 5d0e4c170..2b59a627c 100644 --- a/workflow/public_html/.htaccess +++ b/workflow/public_html/.htaccess @@ -3,7 +3,7 @@ Deny from all - + Order Allow,Deny Allow from All - \ No newline at end of file +