From 40d78b67d03624b2ac7908c56381dab3825ede6b Mon Sep 17 00:00:00 2001 From: SatoshiDark Date: Thu, 9 Jun 2016 16:57:42 -0400 Subject: [PATCH 1/3] ALF-14: Enable plugin triggers build script to include plugin changes --- build.php | 37 + class.Build.php | 1397 +++++++++++++++++ .../engine/classes/class.pluginRegistry.php | 20 +- .../engine/methods/setup/pluginsChange.php | 12 + 4 files changed, 1463 insertions(+), 3 deletions(-) create mode 100644 build.php create mode 100755 class.Build.php diff --git a/build.php b/build.php new file mode 100644 index 000000000..2932cfb64 --- /dev/null +++ b/build.php @@ -0,0 +1,37 @@ + 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 new file mode 100755 index 000000000..1bd3c8053 --- /dev/null +++ b/class.Build.php @@ -0,0 +1,1397 @@ +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 . "/workflow/buildTemp"; + $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"); + copy("$source/build/js/pmui-$version.js", "$pmUIDir/pmui.min.js"); + 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"); + 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"); + copy($source . "/lib/wz_jsgraphics/wz_jsgraphics.js", $jsTargetDir . "/wz_jsgraphics.js"); + copy($source . "/lib/jQuery/jquery-1.10.2.min.js", $jsTargetDir . "/jquery-1.10.2.min.js"); + copy($source . "/lib/underscore/underscore-min.js", $jsTargetDir . "/underscore-min.js"); + copy($source . "/lib/jQueryUI/jquery-ui-1.10.3.custom.min.js", $jsTargetDir . "/jquery-ui-1.10.3.custom.min.js"); + copy($source . "/lib/jQueryLayout/jquery.layout.min.js", $jsTargetDir . "/jquery.layout.min.js"); + 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) { + + } + } +} + +/** + * 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; + + /** + * Class constructor. + * + */ + public function __construct() + { + $this->extensionsJsConfig = ""; + $this->silentMode = false; + } + + /** + * 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; + } + + /** + * 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)) { + mkdir($dst); + } + $files = scandir($src); + foreach ($files as $file) + if ($file != "." && $file != "..") $this->recCopy("$src/$file", "$dst/$file"); + } else if (file_exists($src)) copy($src, $dst); + } + + /** + * 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)) { + copy($tmp . $file, $dest . $destFile); + } else { + 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('/', $dir); + $file = array_pop($parts); + $dir = ''; + foreach ($parts as $part) + if (!is_dir($dir .= "/$part")) mkdir($dir); + file_put_contents("$dir/$file", $contents); + } + + /** + * 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; + } + file_put_contents($directory . "/" . $filename, $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; + } + 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); + copy($source . "/appMobile/appBuild.js", $dev . "/appBuild.js"); + copy($source . "/img/geoMap.jpg", $dev . "/geoMap.jpg"); + $htmlFile = $this->joinFiles($source, $index); + file_put_contents($dev . "/index.html", $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); + + copy($source . "/appMobile/appBuild.js", $prod . "/appBuild.js"); + copy($source . "/img/geoMap.jpg", $prod . "/geoMap.jpg"); + $this->recCopy($source . "/img", $prod . "/img", false); + $htmlFile = $this->joinFiles($source, $index); + file_put_contents($prod . "/index.html", $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(); + + 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 = ""; + + /** + * Class Constructor + */ + public function __construct() + { + + } + + /** + * 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/workflow/engine/classes/class.pluginRegistry.php b/workflow/engine/classes/class.pluginRegistry.php index d43bd41da..98ec21f23 100755 --- a/workflow/engine/classes/class.pluginRegistry.php +++ b/workflow/engine/classes/class.pluginRegistry.php @@ -1791,7 +1791,6 @@ class PMPluginRegistry return $this->_aOpenReassignCallback; } - public function getPluginsData() { return $this->_aPlugins; @@ -1825,7 +1824,7 @@ class PMPluginRegistry */ public function isEnterprisePlugin($pluginName, $path = null) { - $path = (!is_null($path) && $path != '')? rtrim($path, '/\\') . PATH_SEP : PATH_PLUGINS; + $path = (!is_null($path) && $path != '') ? rtrim($path, '/\\') . PATH_SEP : PATH_PLUGINS; $pluginFile = $pluginName . '.php'; //Return @@ -1834,5 +1833,20 @@ 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; + } } - diff --git a/workflow/engine/methods/setup/pluginsChange.php b/workflow/engine/methods/setup/pluginsChange.php index 581f1de7b..8db040983 100755 --- a/workflow/engine/methods/setup/pluginsChange.php +++ b/workflow/engine/methods/setup/pluginsChange.php @@ -21,6 +21,8 @@ * 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']; @@ -86,6 +88,16 @@ 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(); From 984385f94105630ff08d52b041f72333eea3b43a Mon Sep 17 00:00:00 2001 From: dheeyi william Date: Thu, 4 Aug 2016 16:38:54 -0400 Subject: [PATCH 2/3] HOR-1554 Case Title cannot be set for the parallel tasks Valeo HOR-1554 Case Title cannot be set for the parallel tasks Valeo HOR-1554 Case Title cannot be set for the parallel tasks Valeo HOR-1554 Case Title cannot be set for the parallel tasks Valeo --- workflow/engine/classes/class.case.php | 18 +++++++++++++----- workflow/engine/classes/model/ListPaused.php | 6 ++++-- .../engine/classes/model/ListUnassigned.php | 1 - workflow/engine/methods/cases/cases_Ajax.php | 3 ++- workflow/engine/templates/cases/casesList.js | 3 ++- 5 files changed, 21 insertions(+), 10 deletions(-) diff --git a/workflow/engine/classes/class.case.php b/workflow/engine/classes/class.case.php index 3acc34f46..dce453733 100755 --- a/workflow/engine/classes/class.case.php +++ b/workflow/engine/classes/class.case.php @@ -739,6 +739,9 @@ class Cases $cri->addSelectColumn(AppDelegationPeer::TAS_UID); $cri->add(AppDelegationPeer::APP_UID, $sAppUid); $cri->add(AppDelegationPeer::DEL_THREAD_STATUS, "OPEN"); + if(isset($fields['DEL_INDEX'])){ + $cri->add(AppDelegationPeer::DEL_INDEX, $fields['DEL_INDEX']); + } $rsCri = AppDelegationPeer::doSelectRS($cri); $rsCri->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rsCri->next(); @@ -908,6 +911,9 @@ class Cases if (isset($Fields['APP_DESCRIPTION'])) { $appFields['APP_DESCRIPTION'] = $Fields['APP_DESCRIPTION']; } + if(isset($Fields['DEL_INDEX'])){ + $appFields['DEL_INDEX'] = $Fields['DEL_INDEX']; + } $arrayNewCaseTitleAndDescription = $this->newRefreshCaseTitleAndDescription($sAppUid, $appFields, $aApplicationFields); @@ -2106,6 +2112,7 @@ class Cases //DONE: Al ya existir un delegation, se puede "calcular" el caseTitle. $Fields = $Application->toArray(BasePeer::TYPE_FIELDNAME); $aApplicationFields = $Fields['APP_DATA']; + $Fields['DEL_INDEX'] = $iDelIndex; $newValues = $this->newRefreshCaseTitleAndDescription($sAppUid, $Fields, $aApplicationFields); if (!isset($newValues['APP_TITLE'])) { $newValues['APP_TITLE'] = ''; @@ -3943,7 +3950,7 @@ class Cases * @return object */ - public function pauseCase($sApplicationUID, $iDelegation, $sUserUID, $sUnpauseDate = null) + public function pauseCase($sApplicationUID, $iDelegation, $sUserUID, $sUnpauseDate = null, $appTitle = null) { // Check if the case is unassigned if($this->isUnassignedPauseCase($sApplicationUID, $iDelegation)){ @@ -3992,11 +3999,12 @@ class Cases $this->getExecuteTriggerProcess($sApplicationUID, 'PAUSED'); /*----------------------------------********---------------------------------*/ - $data = array ( - 'APP_UID' => $sApplicationUID, + $data = array( + 'APP_UID' => $sApplicationUID, 'DEL_INDEX' => $iDelegation, - 'USR_UID' => $sUserUID, - 'APP_RESTART_DATE' => $sUnpauseDate + 'USR_UID' => $sUserUID, + 'APP_RESTART_DATE' => $sUnpauseDate, + 'APP_TITLE' => ($appTitle != null) ? $appTitle : $aFields['APP_TITLE'] ); $data = array_merge($aFields, $data); $oListPaused = new ListPaused(); diff --git a/workflow/engine/classes/model/ListPaused.php b/workflow/engine/classes/model/ListPaused.php index 8ae47a8a9..f1ed85a22 100644 --- a/workflow/engine/classes/model/ListPaused.php +++ b/workflow/engine/classes/model/ListPaused.php @@ -26,12 +26,14 @@ class ListPaused extends BaseListPaused { { $criteria = new Criteria(); $criteria->addSelectColumn(ApplicationPeer::APP_TITLE); - $criteria->add( ApplicationPeer::APP_UID, $data['APP_UID'], Criteria::EQUAL ); + $criteria->add(ApplicationPeer::APP_UID, $data['APP_UID'], Criteria::EQUAL); $dataset = ApplicationPeer::doSelectRS($criteria); $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $dataset->next(); $aRow = $dataset->getRow(); - $data['APP_TITLE'] = $aRow['APP_TITLE']; + if (!isset($data['APP_TITLE'])) { + $data['APP_TITLE'] = $aRow['APP_TITLE']; + } $criteria = new Criteria(); $criteria->addSelectColumn(ProcessPeer::PRO_TITLE); diff --git a/workflow/engine/classes/model/ListUnassigned.php b/workflow/engine/classes/model/ListUnassigned.php index 912baa31c..e698240a6 100644 --- a/workflow/engine/classes/model/ListUnassigned.php +++ b/workflow/engine/classes/model/ListUnassigned.php @@ -103,7 +103,6 @@ class ListUnassigned extends BaseListUnassigned $criteria = new Criteria(); $criteria->addSelectColumn( ApplicationPeer::APP_NUMBER ); - $criteria->addSelectColumn( ApplicationPeer::APP_TITLE ); $criteria->addSelectColumn( ApplicationPeer::APP_UPDATE_DATE ); $criteria->add( ApplicationPeer::APP_UID, $data['APP_UID'], Criteria::EQUAL ); $dataset = ApplicationPeer::doSelectRS($criteria); diff --git a/workflow/engine/methods/cases/cases_Ajax.php b/workflow/engine/methods/cases/cases_Ajax.php index 211cbbdfc..c62ad5b9c 100644 --- a/workflow/engine/methods/cases/cases_Ajax.php +++ b/workflow/engine/methods/cases/cases_Ajax.php @@ -405,8 +405,9 @@ switch (($_POST['action']) ? $_POST['action'] : $_REQUEST['action']) { $APP_UID = $_SESSION['APPLICATION']; $DEL_INDEX = $_SESSION['INDEX']; } + $appTitle = $_POST['APP_TITLE']; - $oCase->pauseCase( $APP_UID, $DEL_INDEX, $_SESSION['USER_LOGGED'], $unpauseDate ); + $oCase->pauseCase($APP_UID, $DEL_INDEX, $_SESSION['USER_LOGGED'], $unpauseDate, $appTitle); break; case 'unpauseCase': $sApplicationUID = (isset( $_POST['sApplicationUID'] )) ? $_POST['sApplicationUID'] : $_SESSION['APPLICATION']; diff --git a/workflow/engine/templates/cases/casesList.js b/workflow/engine/templates/cases/casesList.js index dbf491564..474f91b7d 100755 --- a/workflow/engine/templates/cases/casesList.js +++ b/workflow/engine/templates/cases/casesList.js @@ -344,7 +344,8 @@ function pauseCase(date){ APP_UID: rowModel.data.APP_UID, DEL_INDEX: rowModel.data.DEL_INDEX, NOTE_REASON: noteReasonTxt, - NOTIFY_PAUSE: notifyReasonVal + NOTIFY_PAUSE: notifyReasonVal, + APP_TITLE: rowModel.data.APP_TITLE } }); } From cb440639b59ef0576727628b30b2c71b6535a629 Mon Sep 17 00:00:00 2001 From: Luis Fernando Saisa Lopez Date: Mon, 8 Aug 2016 13:20:58 -0400 Subject: [PATCH 3/3] HOR-1528-A "Cuando se configura a un..." --- workflow/engine/menus/simplified.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/workflow/engine/menus/simplified.php b/workflow/engine/menus/simplified.php index 78e0552c6..f6d7d4268 100644 --- a/workflow/engine/menus/simplified.php +++ b/workflow/engine/menus/simplified.php @@ -12,7 +12,16 @@ if ($RBAC->userCanAccess("PM_CASES") == 1) { "/images/simplified/folder-grey3.png", null, null, null); $G_TMP_MENU->AddIdRawOption("S_NEW_CASE", "#", G::LoadTranslation("ID_NEW_CASE"), "/images/simplified/plus-set-grey.png", null, null, null); - $G_TMP_MENU->AddIdRawOption("S_ADVANCED_SEARCH", "home/appAdvancedSearch", G::LoadTranslation("ID_ADVANCEDSEARCH"), - "/images/simplified/advancedSearch.png", null, null, null); } +if ($RBAC->userCanAccess('PM_ALLCASES') == 1) { + $G_TMP_MENU->AddIdRawOption( + 'S_ADVANCED_SEARCH', + 'home/appAdvancedSearch', + G::LoadTranslation('ID_ADVANCEDSEARCH'), + '/images/simplified/advancedSearch.png', + null, + null, + null + ); +}