diff --git a/composer.json b/composer.json index e27cf61f1..31efbdf98 100644 --- a/composer.json +++ b/composer.json @@ -29,9 +29,9 @@ "require": { "luracast/restler": "3.0.0-RC4", "bshaffer/oauth2-server-php": "v1.0", - "colosa/pmUI": "3.0.1.8", - "colosa/MichelangeloFE": "3.0.1.8", - "colosa/pmdynaform": "3.0.1.8", + "colosa/pmUI": "3.0.1.8-dev", + "colosa/MichelangeloFE": "3.0.1.8-dev", + "colosa/pmdynaform": "3.0.1.8-dev", "google/apiclient": "1.1.6" }, "require-dev": { diff --git a/composer.lock b/composer.lock index 5d9eca8cb..f551bbfc2 100644 --- a/composer.lock +++ b/composer.lock @@ -1,11 +1,10 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "0c32f709dc7d394fd4b3a2d9815debdd", - "content-hash": "20afa3cb3b19d6017ab1d815ae710ba7", + "hash": "9c7ee173ce908a40f4ed9aecaa30b068", "packages": [ { "name": "bshaffer/oauth2-server-php", @@ -30,7 +29,7 @@ "OAuth2": "src/" } }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -38,7 +37,7 @@ { "name": "Brent Shaffer", "email": "bshafs@gmail.com", - "homepage": "http://github.com/bshaffer" + "homepage": "http://brentertainment.com" } ], "description": "OAuth2 Server for PHP", @@ -52,14 +51,14 @@ }, { "name": "colosa/MichelangeloFE", - "version": "3.0.1.7-dev", + "version": "3.0.1.8-dev", "source": { "type": "git", "url": "git@bitbucket.org:colosa/michelangelofe.git", - "reference": "0757f3f82796055f09ae738709a6211f8b604e37" + "reference": "8878311a3f6c08cad2a0ee2cff9f6ecb7aa097a7" }, "require": { - "colosa/pmui": "3.0.1.7-dev" + "colosa/pmui": "3.0.1.8-dev" }, "type": "library", "description": "ProcessMaker Michelangelo Front End", @@ -67,15 +66,15 @@ "keywords": [ "js app ProcessMaker" ], - "time": "2015-12-18 18:45:41" + "time": "2016-02-29 19:49:15" }, { "name": "colosa/pmDynaform", - "version": "3.0.1.7-dev", + "version": "3.0.1.8-dev", "source": { "type": "git", "url": "git@bitbucket.org:colosa/pmdynaform.git", - "reference": "30597cf9fe5b8be2830b5e684370d59465028d40" + "reference": "320128bf394f851209d9216123a45afd269bcf4c" }, "type": "library", "description": "JS Library to render ProcessMaker Dynaforms", @@ -83,15 +82,15 @@ "keywords": [ "js lib ProcessMaker Dynaforms" ], - "time": "2015-12-23 16:32:42" + "time": "2016-02-26 21:40:47" }, { "name": "colosa/pmUI", - "version": "3.0.1.7-dev", + "version": "3.0.1.8-dev", "source": { "type": "git", "url": "git@bitbucket.org:colosa/pmui.git", - "reference": "df12385940b2d8d687bd8ec24aed9cdda2a45fa9" + "reference": "851ee86a1006df111ee8b281bf2b033cdbcc6f0b" }, "type": "library", "description": "JS UI Library", @@ -99,7 +98,7 @@ "keywords": [ "js lib ProcessMaker UI" ], - "time": "2015-12-18 18:45:38" + "time": "2016-02-26 21:41:50" }, { "name": "google/apiclient", @@ -222,726 +221,25 @@ "packages-dev": [ { "name": "behat/behat", - "version": "v2.4.6", - "source": { - "type": "git", - "url": "https://github.com/Behat/Behat.git", - "reference": "f1d2964667cf4b21bb6c2c1564f26829a6954155" - }, + "version": "2.4.6", "dist": { "type": "zip", "url": "https://api.github.com/repos/Behat/Behat/zipball/f1d2964667cf4b21bb6c2c1564f26829a6954155", - "reference": "f1d2964667cf4b21bb6c2c1564f26829a6954155", - "shasum": "" + "reference": null, + "shasum": "d8aada3ba96925c26f242a602f4692709810a39b" }, - "require": { - "behat/gherkin": "~2.2.9", - "php": ">=5.3.1", - "symfony/config": "~2.0", - "symfony/console": "~2.0", - "symfony/dependency-injection": "~2.0", - "symfony/event-dispatcher": "~2.0", - "symfony/finder": "~2.0", - "symfony/translation": "~2.0", - "symfony/yaml": "~2.0" - }, - "require-dev": { - "phpunit/phpunit": "~3.7.19" - }, - "suggest": { - "behat/mink-extension": "for integration with Mink testing framework", - "behat/symfony2-extension": "for integration with Symfony2 web framework", - "behat/yii-extension": "for integration with Yii web framework" - }, - "bin": [ - "bin/behat" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-develop": "2.4-dev" - } - }, - "autoload": { - "psr-0": { - "Behat\\Behat": "src/" - } - }, - "notification-url": "http://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - } - ], - "description": "Scenario-oriented BDD framework for PHP 5.3", - "homepage": "http://behat.org/", - "keywords": [ - "BDD", - "Behat", - "Symfony2" - ], - "time": "2013-06-06 10:46:48" - }, - { - "name": "behat/gherkin", - "version": "v2.2.9", - "source": { - "type": "git", - "url": "https://github.com/Behat/Gherkin.git", - "reference": "cca2c477921ca38578d6e9759ea5e450f29c2d8f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Behat/Gherkin/zipball/cca2c477921ca38578d6e9759ea5e450f29c2d8f", - "reference": "cca2c477921ca38578d6e9759ea5e450f29c2d8f", - "shasum": "" - }, - "require": { - "php": ">=5.3.1", - "symfony/finder": ">=2.0,<2.4-dev" - }, - "require-dev": { - "symfony/config": ">=2.0,<2.4-dev", - "symfony/translation": ">=2.0,<2.4-dev", - "symfony/yaml": ">=2.0,<2.4-dev" - }, - "suggest": { - "symfony/config": "If you want to use Config component to manage resources", - "symfony/translation": "If you want to use Symfony2 translations adapter", - "symfony/yaml": "If you want to parse features, represented in YAML files" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-develop": "2.2-dev" - } - }, - "autoload": { - "psr-0": { - "Behat\\Gherkin": "src/" - } - }, - "notification-url": "http://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - } - ], - "description": "Gherkin DSL parser for PHP 5.3", - "homepage": "http://behat.org/", - "keywords": [ - "BDD", - "Behat", - "DSL", - "Symfony2", - "parser" - ], - "time": "2013-03-02 10:38:40" + "type": "library" }, { "name": "guzzle/guzzle", - "version": "v3.1.2", - "source": { - "type": "git", - "url": "https://github.com/guzzle/guzzle.git", - "reference": "7901ea7d27373d0cc85eac6f6694e4c2ced90a26" - }, + "version": "3.1.2", "dist": { "type": "zip", "url": "https://api.github.com/repos/guzzle/guzzle/zipball/7901ea7d27373d0cc85eac6f6694e4c2ced90a26", - "reference": "7901ea7d27373d0cc85eac6f6694e4c2ced90a26", - "shasum": "" + "reference": null, + "shasum": "25bc38119541c151c455c3140b4dc388d7ec4187" }, - "require": { - "ext-curl": "*", - "php": ">=5.3.2", - "symfony/event-dispatcher": ">=2.1" - }, - "replace": { - "guzzle/batch": "self.version", - "guzzle/cache": "self.version", - "guzzle/common": "self.version", - "guzzle/http": "self.version", - "guzzle/inflection": "self.version", - "guzzle/iterator": "self.version", - "guzzle/log": "self.version", - "guzzle/parser": "self.version", - "guzzle/plugin": "self.version", - "guzzle/plugin-async": "self.version", - "guzzle/plugin-backoff": "self.version", - "guzzle/plugin-cache": "self.version", - "guzzle/plugin-cookie": "self.version", - "guzzle/plugin-curlauth": "self.version", - "guzzle/plugin-history": "self.version", - "guzzle/plugin-log": "self.version", - "guzzle/plugin-md5": "self.version", - "guzzle/plugin-mock": "self.version", - "guzzle/plugin-oauth": "self.version", - "guzzle/service": "self.version", - "guzzle/stream": "self.version" - }, - "require-dev": { - "doctrine/common": "*", - "monolog/monolog": "1.*", - "phpunit/phpunit": "3.7.*", - "symfony/class-loader": "*", - "zend/zend-cache1": "1.12", - "zend/zend-log1": "1.12", - "zendframework/zend-cache": "2.0.*", - "zendframework/zend-log": "2.0.*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1-dev" - } - }, - "autoload": { - "psr-0": { - "Guzzle\\Tests": "tests/", - "Guzzle": "src/" - } - }, - "notification-url": "http://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - }, - { - "name": "Guzzle Community", - "homepage": "https://github.com/guzzle/guzzle/contributors" - } - ], - "description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "client", - "curl", - "framework", - "http", - "http client", - "rest", - "web service" - ], - "time": "2013-01-28 00:07:40" - }, - { - "name": "symfony/config", - "version": "v2.8.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/config.git", - "reference": "41ee6c70758f40fa1dbf90d019ae0a66c4a09e74" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/41ee6c70758f40fa1dbf90d019ae0a66c4a09e74", - "reference": "41ee6c70758f40fa1dbf90d019ae0a66c4a09e74", - "shasum": "" - }, - "require": { - "php": ">=5.3.9", - "symfony/filesystem": "~2.3|~3.0.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Config\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "http://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Config Component", - "homepage": "https://symfony.com", - "time": "2016-01-03 15:33:41" - }, - { - "name": "symfony/console", - "version": "v2.8.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "d0239fb42f98dd02e7d342f793c5d2cdee0c478d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/d0239fb42f98dd02e7d342f793c5d2cdee0c478d", - "reference": "d0239fb42f98dd02e7d342f793c5d2cdee0c478d", - "shasum": "" - }, - "require": { - "php": ">=5.3.9", - "symfony/polyfill-mbstring": "~1.0" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/event-dispatcher": "~2.1|~3.0.0", - "symfony/process": "~2.1|~3.0.0" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/process": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "http://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Console Component", - "homepage": "https://symfony.com", - "time": "2016-01-14 08:33:16" - }, - { - "name": "symfony/dependency-injection", - "version": "v2.8.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/dependency-injection.git", - "reference": "ba94a914e244e0d05f0aaef460d5558d5541d2b1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/ba94a914e244e0d05f0aaef460d5558d5541d2b1", - "reference": "ba94a914e244e0d05f0aaef460d5558d5541d2b1", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "conflict": { - "symfony/expression-language": "<2.6" - }, - "require-dev": { - "symfony/config": "~2.2|~3.0.0", - "symfony/expression-language": "~2.6|~3.0.0", - "symfony/yaml": "~2.1|~3.0.0" - }, - "suggest": { - "symfony/config": "", - "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", - "symfony/yaml": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\DependencyInjection\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "http://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony DependencyInjection Component", - "homepage": "https://symfony.com", - "time": "2016-01-12 17:46:01" - }, - { - "name": "symfony/event-dispatcher", - "version": "v2.8.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "ee278f7c851533e58ca307f66305ccb9188aceda" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/ee278f7c851533e58ca307f66305ccb9188aceda", - "reference": "ee278f7c851533e58ca307f66305ccb9188aceda", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.0,>=2.0.5|~3.0.0", - "symfony/dependency-injection": "~2.6|~3.0.0", - "symfony/expression-language": "~2.6|~3.0.0", - "symfony/stopwatch": "~2.3|~3.0.0" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "http://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony EventDispatcher Component", - "homepage": "https://symfony.com", - "time": "2016-01-13 10:28:07" - }, - { - "name": "symfony/filesystem", - "version": "v2.8.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "637b64d0ee10f44ae98dbad651b1ecdf35a11e8c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/637b64d0ee10f44ae98dbad651b1ecdf35a11e8c", - "reference": "637b64d0ee10f44ae98dbad651b1ecdf35a11e8c", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Filesystem\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "http://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Filesystem Component", - "homepage": "https://symfony.com", - "time": "2016-01-13 10:28:07" - }, - { - "name": "symfony/finder", - "version": "v2.3.37", - "target-dir": "Symfony/Component/Finder", - "source": { - "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "ebc6186d49e5d25399d76451a022738dc8a9476b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/ebc6186d49e5d25399d76451a022738dc8a9476b", - "reference": "ebc6186d49e5d25399d76451a022738dc8a9476b", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.3-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\Finder\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "http://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Finder Component", - "homepage": "https://symfony.com", - "time": "2016-01-13 17:07:01" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.1.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "1289d16209491b584839022f29257ad859b8532d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/1289d16209491b584839022f29257ad859b8532d", - "reference": "1289d16209491b584839022f29257ad859b8532d", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "http://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "time": "2016-01-20 09:13:37" - }, - { - "name": "symfony/translation", - "version": "v2.8.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/translation.git", - "reference": "bc0b666903944858f4ffec01c4e50c63e5c276c0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/bc0b666903944858f4ffec01c4e50c63e5c276c0", - "reference": "bc0b666903944858f4ffec01c4e50c63e5c276c0", - "shasum": "" - }, - "require": { - "php": ">=5.3.9", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "symfony/config": "<2.7" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.8", - "symfony/intl": "~2.4|~3.0.0", - "symfony/yaml": "~2.2|~3.0.0" - }, - "suggest": { - "psr/log": "To use logging capability in translator", - "symfony/config": "", - "symfony/yaml": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Translation\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "http://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Translation Component", - "homepage": "https://symfony.com", - "time": "2016-01-03 15:33:41" - }, - { - "name": "symfony/yaml", - "version": "v2.8.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "34c8a4b51e751e7ea869b8262f883d008a2b81b8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/34c8a4b51e751e7ea869b8262f883d008a2b81b8", - "reference": "34c8a4b51e751e7ea869b8262f883d008a2b81b8", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "http://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com", - "time": "2016-01-13 10:28:07" + "type": "library" } ], "aliases": [], diff --git a/workflow/engine/classes/class.pmFunctions.php b/workflow/engine/classes/class.pmFunctions.php index da63e0fdd..30eabd9f8 100755 --- a/workflow/engine/classes/class.pmFunctions.php +++ b/workflow/engine/classes/class.pmFunctions.php @@ -264,8 +264,11 @@ function executeQuery ($SqlStatement, $DBConnectionUID = 'workflow', $aParameter $rs = $con->executeUpdate( $SqlStatement ); $result = $con->getUpdateCount(); $con->commit(); - //$result = $lastId->getId(); - // $result = 1; + break; + case preg_match( "/^REPLACE\s/i", $statement ): + $rs = $con->executeUpdate( $SqlStatement ); + $result = $con->getUpdateCount(); + $con->commit(); break; case preg_match( "/^UPDATE\s/i", $statement ): $rs = $con->executeUpdate( $SqlStatement ); diff --git a/workflow/engine/config/schema.xml b/workflow/engine/config/schema.xml index 9e02da358..40a780fac 100755 --- a/workflow/engine/config/schema.xml +++ b/workflow/engine/config/schema.xml @@ -381,6 +381,16 @@ + + + + + + + + + + @@ -2503,6 +2513,15 @@ + + + + + + + + + diff --git a/workflow/engine/controllers/pmTablesProxy.php b/workflow/engine/controllers/pmTablesProxy.php index ad51c01f5..2c4740679 100755 --- a/workflow/engine/controllers/pmTablesProxy.php +++ b/workflow/engine/controllers/pmTablesProxy.php @@ -692,7 +692,7 @@ class pmTablesProxy extends HttpProxyController $sErrorMessages = ''; $i = 1; $conData = 0; - $insert = 'INSERT INTO ' . $aAdditionalTables['ADD_TAB_NAME'] . ' ('; + $insert = 'REPLACE INTO ' . $aAdditionalTables['ADD_TAB_NAME'] . ' ('; $query = ''; $swHead = false; while (($aAux = fgetcsv( $oFile, 4096, $_POST['form']['CSV_DELIMITER'] )) !== false) { @@ -720,7 +720,7 @@ class pmTablesProxy extends HttpProxyController $j = 0; foreach ($aAdditionalTables['FIELDS'] as $aField) { $conData++; - $temp = isset($aAux[$j]) ? '"'.addslashes($aAux[$j]).'"' : '""'; + $temp = isset($aAux[$j]) ? '"'.addslashes(stripslashes($aAux[$j])).'"' : '""'; if ($temp == '') { switch ($aField['FLD_TYPE']) { case 'DATE': @@ -889,7 +889,7 @@ class pmTablesProxy extends HttpProxyController $SDATA = ""; $cnt = count( $cols ); foreach ($cols as $key => $val) { - $SDATA .= $val; + $SDATA .= addslashes($val); if (-- $cnt > 0) { $SDATA .= $sDelimiter; } diff --git a/workflow/engine/data/mysql/schema.sql b/workflow/engine/data/mysql/schema.sql index 8f66c4477..0de8fa742 100755 --- a/workflow/engine/data/mysql/schema.sql +++ b/workflow/engine/data/mysql/schema.sql @@ -178,6 +178,8 @@ CREATE TABLE `CONTENT` `CON_LANG` VARCHAR(10) default '' NOT NULL, `CON_VALUE` MEDIUMTEXT NOT NULL, PRIMARY KEY (`CON_CATEGORY`,`CON_PARENT`,`CON_ID`,`CON_LANG`), + KEY `indexUidLang`(`CON_ID`, `CON_LANG`), + KEY `indexCatParUidLang`(`CON_CATEGORY`, `CON_PARENT`, `CON_ID`, `CON_LANG`), KEY `indexUid`(`CON_ID`, `CON_CATEGORY`, `CON_LANG`) )ENGINE=InnoDB DEFAULT CHARSET='utf8'; #----------------------------------------------------------------------------- @@ -1193,6 +1195,7 @@ CREATE TABLE `APP_CACHE_VIEW` `APP_UPDATE_DATE` DATETIME NOT NULL, `APP_OVERDUE_PERCENTAGE` DOUBLE NOT NULL, PRIMARY KEY (`APP_UID`,`DEL_INDEX`), + KEY `indexProUid`(`PRO_UID`), KEY `indexAppNumber`(`APP_NUMBER`), KEY `protitle`(`APP_PRO_TITLE`), KEY `appupdatedate`(`APP_UPDATE_DATE`), diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php b/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php index 0a90f20f5..be0981826 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases.php @@ -45,6 +45,21 @@ class Cases } } + /** + * Throw the exception "The Case doesn't exist" + * + * @param string $applicationUid Unique id of Case + * @param string $fieldNameForException Field name for the exception + * + * @return void + */ + private function throwExceptionCaseDoesNotExist($applicationUid, $fieldNameForException) + { + throw new \Exception(\G::LoadTranslation( + 'ID_CASE_DOES_NOT_EXIST2', [$fieldNameForException, $applicationUid] + )); + } + /** * Verify if does not exist the Case in table APPLICATION * @@ -68,13 +83,91 @@ class Cases } if ($flag) { - throw new \Exception(\G::LoadTranslation("ID_CASE_DOES_NOT_EXIST2", array($fieldNameForException, $applicationUid))); + $this->throwExceptionCaseDoesNotExist($applicationUid, $fieldNameForException); } } catch (\Exception $e) { throw $e; } } + /** + * Get Application record + * + * @param string $applicationUid Unique id of Case + * @param array $arrayVariableNameForException Variable name for exception + * @param bool $throwException Flag to throw the exception if the main parameters are invalid or do not exist + * (TRUE: throw the exception; FALSE: returns FALSE) + * + * @return array Returns an array with Application record, ThrowTheException/FALSE otherwise + */ + public function getApplicationRecordByPk( + $applicationUid, + array $arrayVariableNameForException, + $throwException = true + ) { + try { + $obj = \ApplicationPeer::retrieveByPK($applicationUid); + + if (is_null($obj)) { + if ($throwException) { + $this->throwExceptionCaseDoesNotExist( + $applicationUid, $arrayVariableNameForException['$applicationUid'] + ); + } else { + return false; + } + } + + //Return + return $obj->toArray(\BasePeer::TYPE_FIELDNAME); + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get AppDelegation record + * + * @param string $applicationUid Unique id of Case + * @param int $delIndex Delegation index + * @param array $arrayVariableNameForException Variable name for exception + * @param bool $throwException Flag to throw the exception if the main parameters are invalid or do not exist + * (TRUE: throw the exception; FALSE: returns FALSE) + * + * @return array Returns an array with AppDelegation record, ThrowTheException/FALSE otherwise + */ + public function getAppDelegationRecordByPk( + $applicationUid, + $delIndex, + array $arrayVariableNameForException, + $throwException = true + ) { + try { + $obj = \AppDelegationPeer::retrieveByPK($applicationUid, $delIndex); + + if (is_null($obj)) { + if ($throwException) { + throw new \Exception(\G::LoadTranslation( + 'ID_CASE_DEL_INDEX_DOES_NOT_EXIST', + [ + $arrayVariableNameForException['$applicationUid'], + $applicationUid, + $arrayVariableNameForException['$delIndex'], + $delIndex + ] + )); + } else { + return false; + } + } + + //Return + return $obj->toArray(\BasePeer::TYPE_FIELDNAME); + } catch (\Exception $e) { + throw $e; + } + } + /** * Get list counters * diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Cases/Variable.php b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/Variable.php new file mode 100644 index 000000000..cd5f831bf --- /dev/null +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Cases/Variable.php @@ -0,0 +1,804 @@ +runningWorkflow, $this->arrayFieldDefinition, $this->arrayVariableNameForException + ); + + $this->arrayFieldNameForException = $this->getArrayFieldNameForException(); + $this->arrayVariableNameForException = $this->getArrayVariableNameForException(); + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Set runningWorkflow atributte + * + * @param bool $flag + * + * @return void + */ + public function setRunningWorkflow($flag) + { + try { + parent::setRunningWorkflow($flag); + + $this->runningWorkflow = $flag; + + $this->arrayFieldNameForException = $this->getArrayFieldNameForException(); + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Set arrayVariableNameForException atributte by data + * + * @param array $arrayData + * + * @return void + */ + public function setArrayVariableNameForException(array $arrayData) + { + try { + foreach ($arrayData as $key => $value) { + $this->arrayVariableNameForException[$key] = $value; + } + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get Application, AppDelegation and Variable record by data + * + * @param string $applicationUid Unique id of Case + * @param int $delIndex Delegation index + * @param string $variableName Variable name + * @param bool $throwException Flag to throw the exception (This only if the parameters are invalid) + * (TRUE: throw the exception; FALSE: returns FALSE) + * + * @return mixed Returns array with Application, AppDelegation and Variable record, + * ThrowTheException/FALSE otherwise + */ + private function __getApplicationAppDelegationAndVariableRecordByData( + $applicationUid, + $delIndex, + $variableName, + $throwException = true + ) { + try { + $case = new \ProcessMaker\BusinessModel\Cases(); + + $arrayApplicationData = $case->getApplicationRecordByPk( + $applicationUid, $this->arrayVariableNameForException, $throwException + ); + + if ($arrayApplicationData === false) { + return false; + } + + $arrayAppDelegationData = $case->getAppDelegationRecordByPk( + $applicationUid, $delIndex, $this->arrayVariableNameForException, $throwException + ); + + if ($arrayAppDelegationData === false) { + return false; + } + + $variable = new \ProcessMaker\BusinessModel\Variable(); + + $arrayVariableData = $variable->getVariableRecordByName( + $arrayApplicationData['PRO_UID'], $variableName, $this->arrayVariableNameForException, $throwException + ); + + if ($arrayVariableData === false) { + return false; + } + + $case = new \Cases(); + + $arrayApplicationData['APP_DATA'] = $case->unserializeData($arrayApplicationData['APP_DATA']); + + //Return + return [$arrayApplicationData, $arrayAppDelegationData, $arrayVariableData]; + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get Fields of a Grid + * + * @param string $projectUid Unique id of Project + * @param string $gridName Grid name (Variable name) + * + * @return array Returns an array with Fields of a Grid + */ + private function __getGridFieldDefinitions($projectUid, $gridName) + { + try { + $arrayGridField = []; + + //Get data + $criteria = new \Criteria('workflow'); + + $criteria->addSelectColumn(\DynaformPeer::DYN_CONTENT); + + $criteria->add(\DynaformPeer::PRO_UID, $projectUid, \Criteria::EQUAL); + $criteria->add(\DynaformPeer::DYN_CONTENT, '%' . $gridName . '%', \Criteria::LIKE); + + $rsCriteria = \DynaformPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + + while ($rsCriteria->next()) { + $row = $rsCriteria->getRow(); + + $dynaFormContent = \G::json_decode($row['DYN_CONTENT']); + + foreach ($dynaFormContent->items[0]->items as $value) { + $arrayField = $value; + + foreach ($arrayField as $value2) { + $fld = $value2; + + if ($fld->type == 'grid' && $fld->variable == $gridName) { + foreach ($fld->columns as $value3) { + $col = $value3; + + if (!isset($arrayGridField[$col->id])) { + $arrayGridField[$col->id] = $col; + } + } + break 2; + } + } + } + } + + //Return + return $arrayGridField; + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Validate data + * + * @param array $arrayData Data + * @param array $arrayVariableData Variable data + * @param bool $throwException Flag to throw the exception (This only if the parameters are invalid) + * (TRUE: throw the exception; FALSE: returns FALSE) + * + * @return bool Returns TRUE when array data is valid, ThrowTheException/FALSE otherwise + */ + private function __validateData(array $arrayData, array $arrayVariableData, $throwException = true) + { + try { + if (empty($arrayData)) { + if ($throwException) { + throw new \Exception(\G::LoadTranslation('ID_INVALID_DATA')); + } else { + return false; + } + } + + if (isset($arrayVariableData['arrayGridField']) && empty($arrayVariableData['arrayGridField'])) { + if ($throwException) { + throw new \Exception(\G::LoadTranslation( + 'ID_GRID_DOES_NOT_HAVE_FIELDS', + [$this->arrayVariableNameForException['$variableName'], $arrayVariableData['VAR_NAME']] + )); + } else { + return false; + } + } + + $msgException = ''; + + switch ($arrayVariableData['VAR_FIELD_TYPE']) { + case 'grid': + foreach ($arrayData as $key => $value) { + $row = $value; + + if (is_array($row)) { + foreach ($arrayVariableData['arrayGridField'] as $value2) { + $field = $value2; + + if (isset($row[$field->id])) { + if (isset($row[$field->id . '_label'])) { + unset($row[$field->id], $row[$field->id . '_label']); + } else { + $msgException = $key . ': ' . $field->id . '_label' . ' ' . + \G::LoadTranslation('ID_DOES_NOT_EXIST'); + break 2; + } + } + } + + if (!empty($row)) { + $msgException = $key . ': ' . \G::LoadTranslation('ID_FIELD_INVALID') . + ' (' . implode(', ', array_keys($row)) . ')'; + break; + } + } else { + $msgException = $key . ': ' . \G::LoadTranslation('ID_INVALID_DATA'); + break; + } + } + break; + default: + $arrayFieldName = [ + $arrayVariableData['VAR_NAME'], + $arrayVariableData['VAR_NAME'] . '_label' + ]; + + foreach ($arrayFieldName as $value) { + if (!isset($arrayData[$value])) { + $msgException = $value . ' ' . \G::LoadTranslation('ID_DOES_NOT_EXIST'); + break; + } + } + break; + } + + if ($msgException != '') { + if ($throwException) { + throw new \Exception($msgException); + } else { + return false; + } + } + + //Return + return true; + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Create Variable for the Case + * + * @param string $applicationUid Unique id of Case + * @param int $delIndex Delegation index + * @param string $variableName Variable name + * @param array $arrayData Data + * @param bool $throwException Flag to throw the exception (This only if the parameters are invalid) + * (TRUE: throw the exception; FALSE: returns FALSE) + * + * @return array Returns data of the new Variable created, ThrowTheException/FALSE otherwise + */ + public function create($applicationUid, $delIndex, $variableName, array $arrayData, $throwException = true) + { + try { + //Verify data and Set variables + $result = $this->__getApplicationAppDelegationAndVariableRecordByData( + $applicationUid, $delIndex, $variableName, $throwException + ); + + if ($result === false) { + return false; + } + + $arrayApplicationData = $result[0]; + $arrayAppDelegationData = $result[1]; + $arrayVariableData = $result[2]; + + if ($arrayVariableData['VAR_FIELD_TYPE'] != 'grid' && + isset($arrayApplicationData['APP_DATA'][$variableName]) + ) { + if ($throwException) { + throw new \Exception(\G::LoadTranslation( + 'ID_CASE_VARIABLE_ALREADY_EXISTS', + [$this->arrayVariableNameForException['$variableName'], $variableName] + )); + } else { + return false; + } + } + + if ($arrayVariableData['VAR_FIELD_TYPE'] == 'grid') { + $arrayVariableData['arrayGridField'] = $this->__getGridFieldDefinitions( + $arrayVariableData['PRJ_UID'], $arrayVariableData['VAR_NAME'] + ); + } + + $result = $this->__validateData($arrayData, $arrayVariableData, $throwException); + + if ($result === false) { + return false; + } + + //Create + $arrayVariable = []; + + switch ($arrayVariableData['VAR_FIELD_TYPE']) { + case 'grid': + $arrayGridData = (isset($arrayApplicationData['APP_DATA'][$variableName]))? + $arrayApplicationData['APP_DATA'][$variableName] : []; + + $i1 = $i2 = count($arrayGridData); + + foreach ($arrayData as $value) { + $i1++; + $arrayGridData[$i1] = $value; + } + + $arrayVariable = array_slice($arrayGridData, $i2, null, true); + + $arrayApplicationData['APP_DATA'][$variableName] = $arrayGridData; + break; + default: + $arrayVariable = [ + $variableName => $arrayData[$variableName], + $variableName . '_label' => $arrayData[$variableName . '_label'] + ]; + + $arrayApplicationData['APP_DATA'] = array_merge($arrayApplicationData['APP_DATA'], $arrayVariable); + break; + } + + $case = new \Cases(); + + $result = $case->updateCase($applicationUid, $arrayApplicationData); + + //Return + return $arrayVariable; + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Update Variable for the Case + * + * @param string $applicationUid Unique id of Case + * @param int $delIndex Delegation index + * @param string $variableName Variable name + * @param array $arrayData Data + * @param bool $throwException Flag to throw the exception (This only if the parameters are invalid) + * (TRUE: throw the exception; FALSE: returns FALSE) + * + * @return bool Returns TRUE when Variable is updated, ThrowTheException/FALSE otherwise + */ + public function update($applicationUid, $delIndex, $variableName, array $arrayData, $throwException = true) + { + try { + //Verify data and Set variables + $result = $this->__getApplicationAppDelegationAndVariableRecordByData( + $applicationUid, $delIndex, $variableName, $throwException + ); + + if ($result === false) { + return false; + } + + $arrayApplicationData = $result[0]; + $arrayAppDelegationData = $result[1]; + $arrayVariableData = $result[2]; + + if (!isset($arrayApplicationData['APP_DATA'][$variableName])) { + if ($throwException) { + throw new \Exception(\G::LoadTranslation( + 'ID_CASE_VARIABLE_DOES_NOT_EXIST', + [$this->arrayVariableNameForException['$variableName'], $variableName] + )); + } else { + return false; + } + } + + if ($arrayVariableData['VAR_FIELD_TYPE'] == 'grid') { + $arrayVariableData['arrayGridField'] = $this->__getGridFieldDefinitions( + $arrayVariableData['PRJ_UID'], $arrayVariableData['VAR_NAME'] + ); + } + + $result = $this->__validateData($arrayData, $arrayVariableData, $throwException); + + if ($result === false) { + return false; + } + + if ($arrayVariableData['VAR_FIELD_TYPE'] == 'grid') { + foreach ($arrayData as $key => $value) { + if (!isset($arrayApplicationData['APP_DATA'][$variableName][$key])) { + if ($throwException) { + throw new \Exception($key . ': ' . \G::LoadTranslation('ID_NO_EXIST')); + } else { + return false; + } + } + } + } + + //Update + switch ($arrayVariableData['VAR_FIELD_TYPE']) { + case 'grid': + foreach ($arrayData as $key => $value) { + $arrayApplicationData['APP_DATA'][$variableName][$key] = array_merge( + $arrayApplicationData['APP_DATA'][$variableName][$key], $value + ); + } + break; + default: + $arrayApplicationData['APP_DATA'] = array_merge( + $arrayApplicationData['APP_DATA'], + [ + $variableName => $arrayData[$variableName], + $variableName . '_label' => $arrayData[$variableName . '_label'] + ] + ); + break; + } + + $case = new \Cases(); + + $result = $case->updateCase($applicationUid, $arrayApplicationData); + + //Return + return true; + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Delete Variable of the Case + * + * @param string $applicationUid Unique id of Case + * @param int $delIndex Delegation index + * @param string $variableName Variable name + * @param array $arrayKey Keys to delete (Only for Grids) + * @param bool $throwException Flag to throw the exception (This only if the parameters are invalid) + * (TRUE: throw the exception; FALSE: returns FALSE) + * + * @return bool Returns TRUE when Variable is deleted, ThrowTheException/FALSE otherwise + */ + public function delete($applicationUid, $delIndex, $variableName, array $arrayKey = null, $throwException = true) + { + try { + //Verify data and Set variables + $result = $this->__getApplicationAppDelegationAndVariableRecordByData( + $applicationUid, $delIndex, $variableName, $throwException + ); + + if ($result === false) { + return false; + } + + $arrayApplicationData = $result[0]; + $arrayAppDelegationData = $result[1]; + $arrayVariableData = $result[2]; + + if (!isset($arrayApplicationData['APP_DATA'][$variableName])) { + if ($throwException) { + throw new \Exception(\G::LoadTranslation( + 'ID_CASE_VARIABLE_DOES_NOT_EXIST', + [$this->arrayVariableNameForException['$variableName'], $variableName] + )); + } else { + return false; + } + } + + if ($arrayVariableData['VAR_FIELD_TYPE'] == 'grid' && !is_null($arrayKey)) { + $msgException = ''; + + if (!empty($arrayKey)) { + foreach ($arrayKey as $value) { + $key = $value; + + if (!isset($arrayApplicationData['APP_DATA'][$variableName][$key])) { + $msgException = $key . ': ' . \G::LoadTranslation('ID_NO_EXIST'); + break; + } + } + } else { + $msgException = \G::LoadTranslation( + 'ID_INVALID_VALUE_CAN_NOT_BE_EMPTY', [$this->arrayVariableNameForException['$arrayKey']] + ); + } + + if ($msgException != '') { + if ($throwException) { + throw new \Exception($msgException); + } else { + return false; + } + } + } + + //Delete + switch ($arrayVariableData['VAR_FIELD_TYPE']) { + case 'grid': + if (!is_null($arrayKey)) { + //Delete keys + foreach ($arrayKey as $value) { + $key = $value; + + unset($arrayApplicationData['APP_DATA'][$variableName][$key]); + } + + //Reset keys + $arrayGridData = []; + $i = 1; + + foreach ($arrayApplicationData['APP_DATA'][$variableName] as $value) { + $arrayGridData[$i] = $value; + $i++; + } + + $arrayApplicationData['APP_DATA'][$variableName] = $arrayGridData; + } else { + unset($arrayApplicationData['APP_DATA'][$variableName]); + } + break; + default: + unset( + $arrayApplicationData['APP_DATA'][$variableName], + $arrayApplicationData['APP_DATA'][$variableName . '_label'] + ); + break; + } + + $case = new \Cases(); + + $result = $case->updateCase($applicationUid, $arrayApplicationData); + + //Return + return true; + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get Variable of a Case + * + * @param string $applicationUid Unique id of Case + * @param int $delIndex Delegation index + * @param string $variableName Variable name + * @param bool $throwException Flag to throw the exception (This only if the parameters are invalid) + * (TRUE: throw the exception; FALSE: returns FALSE) + * + * @return array Returns an array with Variable of a Case, ThrowTheException/FALSE otherwise + */ + public function getVariableByName( + $applicationUid, + $delIndex, + $variableName, + $throwException = true + ) { + try { + $arrayVariable = []; + + //Verify data and Set variables + $result = $this->__getApplicationAppDelegationAndVariableRecordByData( + $applicationUid, $delIndex, $variableName, $throwException + ); + + if ($result === false) { + return false; + } + + $arrayApplicationData = $result[0]; + $arrayAppDelegationData = $result[1]; + $arrayVariableData = $result[2]; + + if (!isset($arrayApplicationData['APP_DATA'][$variableName])) { + if ($throwException) { + throw new \Exception(\G::LoadTranslation( + 'ID_CASE_VARIABLE_DOES_NOT_EXIST', + [$this->arrayVariableNameForException['$variableName'], $variableName] + )); + } else { + return false; + } + } + + //Get Variable + switch ($arrayVariableData['VAR_FIELD_TYPE']) { + case 'grid': + $arrayVariable = $arrayApplicationData['APP_DATA'][$variableName]; + break; + default: + $arrayVariable = [ + $variableName => $arrayApplicationData['APP_DATA'][$variableName], + $variableName . '_label' => isset($arrayApplicationData['APP_DATA'][$variableName . '_label'])? + $arrayApplicationData['APP_DATA'][$variableName . '_label'] : '' + ]; + break; + } + + //Return + return $arrayVariable; + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get Variable of a Case (Only for Grids) + * + * @param string $applicationUid Unique id of Case + * @param int $delIndex Delegation index + * @param string $variableName Variable name + * @param array $arrayFilterData Data of the filters + * @param int $start Start + * @param int $limit Limit + * @param bool $throwException Flag to throw the exception (This only if the parameters are invalid) + * (TRUE: throw the exception; FALSE: returns FALSE) + * + * @return array Returns an array with Variable of a Case, ThrowTheException/FALSE otherwise + */ + public function getVariableByNamePaged( + $applicationUid, + $delIndex, + $variableName, + $arrayFilterData = null, + $start = null, + $limit = null, + $throwException = true + ) { + try { + $arrayVariable = []; + + $numRecTotal = 0; + + //Verify data and Set variables + $flagFilter = !is_null($arrayFilterData) && is_array($arrayFilterData) && isset($arrayFilterData['filter']); + + $result = \ProcessMaker\BusinessModel\Validator::validatePagerDataByPagerDefinition( + [ + $this->arrayVariableNameForException['$start'] => $start, + $this->arrayVariableNameForException['$limit'] => $limit + ], + $this->arrayVariableNameForException + ); + + if ($result !== true) { + if ($throwException) { + throw new \Exception($result); + } else { + return false; + } + } + + $result = $this->__getApplicationAppDelegationAndVariableRecordByData( + $applicationUid, $delIndex, $variableName, $throwException + ); + + if ($result === false) { + return false; + } + + $arrayApplicationData = $result[0]; + $arrayAppDelegationData = $result[1]; + $arrayVariableData = $result[2]; + + if (!isset($arrayApplicationData['APP_DATA'][$variableName])) { + if ($throwException) { + throw new \Exception(\G::LoadTranslation( + 'ID_CASE_VARIABLE_DOES_NOT_EXIST', + [$this->arrayVariableNameForException['$variableName'], $variableName] + )); + } else { + return false; + } + } + + if ($arrayVariableData['VAR_FIELD_TYPE'] != 'grid') { + if ($throwException) { + throw new \Exception(\G::LoadTranslation( + 'ID_VARIABLE_NO_IS_GRID', + [$this->arrayVariableNameForException['$variableName'], $variableName] + )); + } else { + return false; + } + } + + //Set variables + $filterName = 'filter'; + + if ($flagFilter) { + $arrayAux = [ + '' => 'filter', + 'LEFT' => 'lfilter', + 'RIGHT' => 'rfilter' + ]; + + $filterName = $arrayAux[ + (isset($arrayFilterData['filterOption']))? $arrayFilterData['filterOption'] : '' + ]; + } + + //Get Variable + if (!is_null($limit) && (string)($limit) == '0') { + return [ + 'total' => $numRecTotal, + 'start' => (int)((!is_null($start))? $start : 0), + 'limit' => (int)((!is_null($limit))? $limit : 0), + $filterName => ($flagFilter)? $arrayFilterData['filter'] : '', + 'data' => $arrayVariable + ]; + } + + $arraySearch = [ + '' => '.*' . $arrayFilterData['filter'] . '.*', + 'LEFT' => $arrayFilterData['filter'] . '.*', + 'RIGHT' => '.*' . $arrayFilterData['filter'] + ]; + + $search = $arraySearch[ + (isset($arrayFilterData['filterOption']))? $arrayFilterData['filterOption'] : '' + ]; + + foreach ($arrayApplicationData['APP_DATA'][$variableName] as $key => $value) { + if ($flagFilter && trim($arrayFilterData['filter']) != '') { + foreach ($value as $key2 => $value2) { + if (preg_match('/^' . $search . '$/i', $value2)) { + $arrayVariable[$key] = $value; + $numRecTotal++; + break; + } + } + } else { + $arrayVariable[$key] = $value; + $numRecTotal++; + } + } + + $arrayVariable = array_slice( + $arrayVariable, + (!is_null($start))? (int)($start) : 0, + (!is_null($limit))? (int)($limit) : null, + true + ); + + //Return + return [ + 'total' => $numRecTotal, + 'start' => (int)((!is_null($start))? $start : 0), + 'limit' => (int)((!is_null($limit))? $limit : 0), + $filterName => ($flagFilter)? $arrayFilterData['filter'] : '', + 'data' => $arrayVariable + ]; + } catch (\Exception $e) { + throw $e; + } + } +} + diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/DynaForm.php b/workflow/engine/src/ProcessMaker/BusinessModel/DynaForm.php index bc3c58435..0b891f7c2 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/DynaForm.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/DynaForm.php @@ -268,6 +268,21 @@ class DynaForm } } + /** + * Throw the exception "The DynaForm doesn't exist" + * + * @param string $dynaFormUid Unique id of DynaForm + * @param string $fieldNameForException Field name for the exception + * + * @return void + */ + private function throwExceptionDynaFormDoesNotExist($dynaFormUid, $fieldNameForException) + { + throw new \Exception(\G::LoadTranslation( + 'ID_DYNAFORM_DOES_NOT_EXIST', [$fieldNameForException, $dynaFormUid] + )); + } + /** * Verify if doesn't exists the DynaForm in table DYNAFORM * @@ -293,7 +308,7 @@ class DynaForm $rsCriteria = \DynaformPeer::doSelectRS($criteria); if (!$rsCriteria->next()) { - throw new \Exception(\G::LoadTranslation("ID_DYNAFORM_DOES_NOT_EXIST", array($fieldNameForException, $dynaFormUid))); + $this->throwExceptionDynaFormDoesNotExist($dynaFormUid, $fieldNameForException); } } catch (\Exception $e) { throw $e; @@ -345,6 +360,38 @@ class DynaForm } } + /** + * Get DynaForm record + * + * @param string $dynaFormUid Unique id of DynaForm + * @param array $arrayVariableNameForException Variable name for exception + * @param bool $throwException Flag to throw the exception if the main parameters are invalid or do not exist + * (TRUE: throw the exception; FALSE: returns FALSE) + * + * @return array Returns an array with DynaForm record, ThrowTheException/FALSE otherwise + */ + public function getDynaFormRecordByPk($dynaFormUid, array $arrayVariableNameForException, $throwException = true) + { + try { + $obj = \DynaformPeer::retrieveByPK($dynaFormUid); + + if (is_null($obj)) { + if ($throwException) { + $this->throwExceptionDynaFormDoesNotExist( + $dynaFormUid, $arrayVariableNameForException['$dynaFormUid'] + ); + } else { + return false; + } + } + + //Return + return $obj->toArray(\BasePeer::TYPE_FIELDNAME); + } catch (\Exception $e) { + throw $e; + } + } + /** * Create DynaForm for a Process * @@ -553,7 +600,7 @@ class DynaForm $this->throwExceptionIfNotExistsDynaForm($dynaFormUidCopyImport, $processUidCopyImport, $this->getFieldNameByFormatFieldName("COPY_IMPORT.DYN_UID")); //Copy/Import - + //Copy content if version is 2 if ($arrayData["DYN_VERSION"] === 2) { $dynaFormOld = new \Dynaform(); @@ -562,7 +609,7 @@ class DynaForm $arrayData["DYN_CONTENT"] = $arrayDynaFormData["DYN_CONTENT"]; } - + //Create $arrayData = $this->create($processUid, $arrayData); @@ -976,7 +1023,7 @@ class DynaForm if ($record["DYN_VERSION"] == 0) { $record["DYN_VERSION"] = 1; } - + $record["DYN_CONTENT"] = preg_replace("/\\\\u([a-f0-9]{4})/e", "iconv('UCS-4LE','UTF-8',pack('V', hexdec('U$1')))", $record["DYN_CONTENT"]); return array( @@ -1147,7 +1194,7 @@ class DynaForm throw $e; } } - + /** * Get data of a DynaForm History * diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/DynaForm/Grid.php b/workflow/engine/src/ProcessMaker/BusinessModel/DynaForm/Grid.php new file mode 100644 index 000000000..318c88517 --- /dev/null +++ b/workflow/engine/src/ProcessMaker/BusinessModel/DynaForm/Grid.php @@ -0,0 +1,193 @@ +runningWorkflow, $this->arrayFieldDefinition, $this->arrayVariableNameForException + ); + + $this->arrayFieldNameForException = $this->getArrayFieldNameForException(); + $this->arrayVariableNameForException = $this->getArrayVariableNameForException(); + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Set runningWorkflow atributte + * + * @param bool $flag + * + * @return void + */ + public function setRunningWorkflow($flag) + { + try { + parent::setRunningWorkflow($flag); + + $this->runningWorkflow = $flag; + + $this->arrayFieldNameForException = $this->getArrayFieldNameForException(); + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Set arrayVariableNameForException atributte by data + * + * @param array $arrayData + * + * @return void + */ + public function setArrayVariableNameForException(array $arrayData) + { + try { + foreach ($arrayData as $key => $value) { + $this->arrayVariableNameForException[$key] = $value; + } + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get Fields of a Grid + * + * @param string $dynaFormUid Unique id of DynaForm + * @param string $gridName Grid name (Variable name) + * @param bool $throwException Flag to throw the exception if the main parameters are invalid or do not exist + * (TRUE: throw the exception; FALSE: returns FALSE) + * + * @return array Returns an array with Fields of a Grid, ThrowTheException/FALSE otherwise + */ + public function getGridFieldDefinitions($dynaFormUid, $gridName, $throwException = true) + { + try { + //Verify data and Set variables + $dynaForm = new \ProcessMaker\BusinessModel\DynaForm(); + + $arrayDynaFormData = $dynaForm->getDynaFormRecordByPk( + $dynaFormUid, $this->arrayVariableNameForException, $throwException + ); + + if ($arrayDynaFormData === false) { + return false; + } + + //Get data + $dynaFormContent = \G::json_decode($arrayDynaFormData['DYN_CONTENT']); + + $arrayGridField = []; + $flagFound = false; + + foreach ($dynaFormContent->items[0]->items as $value) { + $arrayField = $value; + + foreach ($arrayField as $value2) { + $fld = $value2; + + if ($fld->type == 'grid' && $fld->variable == $gridName) { + $arrayGridField = $fld->columns; + $flagFound = true; + break 2; + } + } + } + + if (!$flagFound) { + if ($throwException) { + throw new \Exception(\G::LoadTranslation( + 'ID_GRID_DOES_NOT_EXIST_IN_DYNAFORM', + [$this->arrayVariableNameForException['$gridName'], $gridName] + )); + } else { + return false; + } + } + + //Return + return $arrayGridField; + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get Field of a Grid + * + * @param string $dynaFormUid Unique id of DynaForm + * @param string $gridName Grid name (Variable name) + * @param string $fieldId Field id + * @param bool $throwException Flag to throw the exception if the main parameters are invalid or do not exist + * (TRUE: throw the exception; FALSE: returns FALSE) + * + * @return array Returns an array with Field of a Grid, ThrowTheException/FALSE otherwise + */ + public function getGridFieldDefinition($dynaFormUid, $gridName, $fieldId, $throwException = true) + { + try { + //Verify data and Set variables + $arrayGridField = $this->getGridFieldDefinitions($dynaFormUid, $gridName, $throwException); + + if ($arrayGridField === false) { + return false; + } + + //Get data + $field = null; + $flagFound = false; + + foreach ($arrayGridField as $value) { + $fld = $value; + + if ($fld->id == $fieldId) { + $field = $fld; + $flagFound = true; + break; + } + } + + if (!$flagFound) { + if ($throwException) { + throw new \Exception(\G::LoadTranslation( + 'ID_GRID_FIELD_DOES_NOT_EXIST', + [$this->arrayVariableNameForException['$fieldId'], $fieldId] + )); + } else { + return false; + } + } + + //Return + return $field; + } catch (\Exception $e) { + throw $e; + } + } +} + diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Process.php b/workflow/engine/src/ProcessMaker/BusinessModel/Process.php index 5352373b9..991d9776d 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Process.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Process.php @@ -325,12 +325,12 @@ class Process public function throwExceptionIfDataNotMetPagerVarDefinition($arrayData, $arrayFieldNameForException) { try { - foreach ($arrayData as $key => $value) { - $nameForException = (isset($arrayFieldNameForException[$key]))? $arrayFieldNameForException[$key] : $key; + $result = \ProcessMaker\BusinessModel\Validator::validatePagerDataByPagerDefinition( + $arrayData, $arrayFieldNameForException + ); - if (!is_null($value) && ($value . "" == "" || !preg_match("/^(?:\+|\-)?(?:0|[1-9]\d*)$/", $value . "") || (int)($value) < 0)) { - throw new \Exception(\G::LoadTranslation('ID_INVALID_VALUE_EXPECTING_POSITIVE_INTEGER', [$nameForException])); - } + if ($result !== true) { + throw new \Exception($result); } } catch (\Exception $e) { throw $e; diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Util/Attribute.php b/workflow/engine/src/ProcessMaker/BusinessModel/Util/Attribute.php new file mode 100644 index 000000000..ed48ab343 --- /dev/null +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Util/Attribute.php @@ -0,0 +1,141 @@ +runningWorkflow = $runningWorkflow; + $this->arrayFieldDefinition = $arrayFieldDefinition; + + foreach ($arrayFieldDefinition as $key => $value) { + if (isset($value['fieldNameAux'])) { + $this->arrayFieldNameForException[$value['fieldNameAux']] = $key; + } + } + + foreach ($arrayVariableNameForException as $value) { + $this->arrayVariableNameForException[$value] = $value; + } + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Set runningWorkflow atributte + * + * @param bool $flag + * + * @return void + */ + public function setRunningWorkflow($flag) + { + try { + $this->runningWorkflow = $flag; + + $this->setArrayFieldNameForException($this->arrayFieldNameForException); + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Set arrayFieldNameForException atributte by data + * + * @param array $arrayData + * + * @return void + */ + public function setArrayFieldNameForException(array $arrayData) + { + try { + foreach ($arrayData as $key => $value) { + $this->arrayFieldNameForException[$key] = $this->convertFieldNameByRunningWorkflow($value); + } + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Set arrayVariableNameForException atributte by data + * + * @param array $arrayData + * + * @return void + */ + public function setArrayVariableNameForException(array $arrayData) + { + try { + foreach ($arrayData as $key => $value) { + $this->arrayVariableNameForException[$key] = $value; + } + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get arrayFieldNameForException atributte + * + * @return array + */ + public function getArrayFieldNameForException() + { + try { + return $this->arrayFieldNameForException; + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get arrayVariableNameForException atributte + * + * @return array + */ + public function getArrayVariableNameForException() + { + try { + return $this->arrayVariableNameForException; + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Convert field name by runningWorkflow + * + * @param string $fieldName + * + * @return string + */ + public function convertFieldNameByRunningWorkflow($fieldName) + { + try { + return ($this->runningWorkflow)? strtoupper($fieldName) : strtolower($fieldName); + } catch (\Exception $e) { + throw $e; + } + } +} + diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Validator.php b/workflow/engine/src/ProcessMaker/BusinessModel/Validator.php index bb622755c..5c61055ae 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Validator.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Validator.php @@ -374,5 +374,38 @@ class Validator throw $e; } } + + /** + * Validate pager data + * + * @param array $arrayData Data + * @param array $arrayVariableNameForException Variable name for exception + * + * @return mixed Returns TRUE when pager data is valid, Message Error otherwise + */ + public static function validatePagerDataByPagerDefinition($arrayPagerData, $arrayVariableNameForException) + { + try { + foreach ($arrayPagerData as $key => $value) { + $nameForException = (isset($arrayVariableNameForException[$key]))? + $arrayVariableNameForException[$key] : $key; + + if (!is_null($value) && + ( + (string)($value) == '' || + !preg_match('/^(?:\+|\-)?(?:0|[1-9]\d*)$/', $value . '') || + (int)($value) < 0 + ) + ) { + return \G::LoadTranslation('ID_INVALID_VALUE_EXPECTING_POSITIVE_INTEGER', [$nameForException]); + } + } + + //Return + return true; + } catch (\Exception $e) { + throw $e; + } + } } diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php b/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php index d8bd70c03..69ea8d1ca 100755 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Variable.php @@ -730,7 +730,7 @@ class Variable $stmt = $cnn->createStatement(); $replaceFields = G::replaceDataField($variableSql, $arrayVariable); - + $filter = ""; if (isset($arrayVariable["filter"])) { $filter = $arrayVariable["filter"]; @@ -763,7 +763,7 @@ class Variable throw $e; } } - + public function queryModified($sqlParsed, $inputSel = "", $searchType = "*searchtype*", $start = 0, $limit = "", $dbConnection = "workflow") { if (!empty($sqlParsed['SELECT'])) { @@ -876,7 +876,7 @@ class Variable } else { $sqlOrderBy = " ORDER BY " . $sFieldSel; } - + $sqlLimit = ""; if ($start >= 0) { $sqlLimit = " LIMIT " . $start; @@ -887,7 +887,7 @@ class Variable if (!empty($sqlParsed['LIMIT'])) { $sqlLimit = " LIMIT " . $sqlParsed['LIMIT']['start'] . ", " . $sqlParsed['LIMIT']['end']; } - + //get database provider $a = new \Criteria("workflow"); $a->addSelectColumn(\DbSourcePeer::DBS_TYPE); @@ -935,7 +935,7 @@ class Variable return $sCall; } } - + public function limitPgsql($start = 0, $limit = "") { $sqlLimit = ""; @@ -990,4 +990,49 @@ class Variable } } + /** + * Get Variable record by name + * + * @param string $projectUid Unique id of Project + * @param string $variableName Variable name + * @param array $arrayVariableNameForException Variable name for exception + * @param bool $throwException Flag to throw the exception if the main parameters are invalid or do not exist + * (TRUE: throw the exception; FALSE: returns FALSE) + * + * @return array Returns an array with Variable record, ThrowTheException/FALSE otherwise + */ + public function getVariableRecordByName( + $projectUid, + $variableName, + array $arrayVariableNameForException, + $throwException = true + ) { + try { + $criteria = new \Criteria('workflow'); + + $criteria->add(\ProcessVariablesPeer::PRJ_UID, $projectUid, \Criteria::EQUAL); + $criteria->add(\ProcessVariablesPeer::VAR_NAME, $variableName, \Criteria::EQUAL); + + $rsCriteria = \ProcessVariablesPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + + if ($rsCriteria->next()) { + $arrayVariableData = $rsCriteria->getRow(); + } else { + if ($throwException) { + throw new \Exception( + $arrayVariableNameForException['$variableName'] . ': ' . $variableName. ' ' . + \G::LoadTranslation('ID_DOES_NOT_EXIST') + ); + } else { + return false; + } + } + + //Return + return $arrayVariableData; + } catch (\Exception $e) { + throw $e; + } + } } diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Cases/Variable.php b/workflow/engine/src/ProcessMaker/Services/Api/Cases/Variable.php new file mode 100644 index 000000000..61620f006 --- /dev/null +++ b/workflow/engine/src/ProcessMaker/Services/Api/Cases/Variable.php @@ -0,0 +1,147 @@ +variable = new \ProcessMaker\BusinessModel\Cases\Variable(); + $this->variable->setRunningWorkflow(false); + $this->variable->setArrayVariableNameForException([ + '$applicationUid' => 'app_uid', + '$delIndex' => 'del_index', + '$variableName' => 'var_name', + '$filter' => 'filter', + '$start' => 'start', + '$limit' => 'limit', + '$arrayKey' => 'keys' + ]); + } catch (\Exception $e) { + throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); + } + } + + /** + * @url GET /:app_uid/:del_index/variable/:var_name/paged + * @url GET /:app_uid/:del_index/variable/:var_name + * + * @param string $app_uid {@min 32}{@max 32} + * @param int $del_index {@min 1} + * @param string $var_name + */ + public function doGetVariable( + $app_uid, + $del_index, + $var_name, + $filter = null, + $lfilter = null, + $rfilter = null, + $start = null, + $limit = null + ) { + try { + if (preg_match("/^.*\/paged.*$/", $this->restler->url)) { + $arrayFilterData = [ + 'filter' => (!is_null($filter))? + $filter : ((!is_null($lfilter))? $lfilter : ((!is_null($rfilter))? $rfilter : null)), + 'filterOption' => (!is_null($filter))? + '' : ((!is_null($lfilter))? 'LEFT' : ((!is_null($rfilter))? 'RIGHT' : '')) + ]; + + $response = $this->variable->getVariableByNamePaged( + $app_uid, $del_index, $var_name, $arrayFilterData, $start, $limit + ); + } else { + $response = $this->variable->getVariableByName($app_uid, $del_index, $var_name); + } + + return \ProcessMaker\Util\DateTime::convertUtcToIso8601($response); + } catch (\Exception $e) { + throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); + } + } + + /** + * @url POST /:app_uid/:del_index/variable/:var_name + * + * @param string $app_uid {@min 32}{@max 32} + * @param int $del_index {@min 1} + * @param string $var_name + * @param array $request_data + * + * @status 201 + */ + public function doPostVariable($app_uid, $del_index, $var_name, array $request_data) + { + try { + $response = $this->variable->create($app_uid, $del_index, $var_name, $request_data); + + return \ProcessMaker\Util\DateTime::convertUtcToIso8601($response); + } catch (\Exception $e) { + throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); + } + } + + /** + * @url PUT /:app_uid/:del_index/variable/:var_name + * + * @param string $app_uid {@min 32}{@max 32} + * @param int $del_index {@min 1} + * @param string $var_name + * @param array $request_data + * + * @status 204 + */ + public function doPutVariable($app_uid, $del_index, $var_name, array $request_data) + { + try { + $response = $this->variable->update($app_uid, $del_index, $var_name, $request_data); + } catch (\Exception $e) { + throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); + } + } + + /** + * @url DELETE /:app_uid/:del_index/variable/:var_name + * + * @param string $app_uid {@min 32}{@max 32} + * @param int $del_index {@min 1} + * @param string $var_name + */ + public function doDeleteVariable($app_uid, $del_index, $var_name, $keys = null) + { + try { + $arrayKey = null; + + if (!is_null($keys)) { + $keys = trim($keys, ' ,'); + $arrayKey = explode(',', $keys); + + if ($keys == '' || !is_array($arrayKey)) { + throw new \Exception(\G::LoadTranslation('ID_INVALID_VALUE', ['keys'])); + } + } + + $response = $this->variable->delete($app_uid, $del_index, $var_name, $arrayKey); + } catch (\Exception $e) { + throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); + } + } +} + diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Project/DynaForm/Grid.php b/workflow/engine/src/ProcessMaker/Services/Api/Project/DynaForm/Grid.php new file mode 100644 index 000000000..e24ff4854 --- /dev/null +++ b/workflow/engine/src/ProcessMaker/Services/Api/Project/DynaForm/Grid.php @@ -0,0 +1,75 @@ +grid = new \ProcessMaker\BusinessModel\DynaForm\Grid(); + $this->grid->setRunningWorkflow(false); + $this->grid->setArrayVariableNameForException([ + '$projectUid' => 'prj_uid', + '$dynaFormUid' => 'dyn_uid', + '$gridName' => 'grd_name', + '$fieldId' => 'fld_id' + ]); + + } catch (\Exception $e) { + throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); + } + } + + /** + * @url GET /:prj_uid/dynaform/:dyn_uid/grid/:grd_name/field-definitions + * + * @param string $prj_uid {@min 32}{@max 32} + * @param string $dyn_uid {@min 32}{@max 32} + * @param string $grd_name + */ + public function doGetDynaFormGridFieldDefinitions($prj_uid, $dyn_uid, $grd_name) + { + try { + $response = $this->grid->getGridFieldDefinitions($dyn_uid, $grd_name); + + return $response; + } catch (\Exception $e) { + throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); + } + } + + /** + * @url GET /:prj_uid/dynaform/:dyn_uid/grid/:grd_name/field-definition/:fld_id + * + * @param string $prj_uid {@min 32}{@max 32} + * @param string $dyn_uid {@min 32}{@max 32} + * @param string $grd_name + * @param string $fld_id + */ + public function doGetDynaFormGridFieldDefinition($prj_uid, $dyn_uid, $grd_name, $fld_id) + { + try { + $response = $this->grid->getGridFieldDefinition($dyn_uid, $grd_name, $fld_id); + + return $response; + } catch (\Exception $e) { + throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); + } + } +} + diff --git a/workflow/engine/src/ProcessMaker/Services/api.ini b/workflow/engine/src/ProcessMaker/Services/api.ini index 6eedd3c3a..9c05af1ba 100644 --- a/workflow/engine/src/ProcessMaker/Services/api.ini +++ b/workflow/engine/src/ProcessMaker/Services/api.ini @@ -21,6 +21,7 @@ debug = 1 trigger2 = "ProcessMaker\Services\Api\Project\Trigger" event = "ProcessMaker\Services\Api\Project\Event" dynaform = "ProcessMaker\Services\Api\Project\DynaForm" + grid = "ProcessMaker\Services\Api\Project\DynaForm\Grid" input-document = "ProcessMaker\Services\Api\Project\InputDocument" output-documents = "ProcessMaker\Services\Api\Project\OutputDocuments" supervisors = "ProcessMaker\Services\Api\Project\ProcessSupervisors" @@ -72,6 +73,7 @@ debug = 1 [alias: case] case = "ProcessMaker\Services\Api\Cases" + variable = "ProcessMaker\Services\Api\Cases\Variable" [alias: cases] case = "ProcessMaker\Services\Api\Cases"